import { Component, Input, OnInit } from '@angular/core';
import { UntilDestroy } from '@ngneat/until-destroy';
import { ProjectItemComponent } from '@app/shared/components/project-item/project-item.component';
import { ProjectFacade } from '@app/ui/projects/project.facade';

@Component({
  selector: 'app-project-list',
  standalone: true,
  imports: [ProjectItemComponent],
  templateUrl: './project-list.component.html',
  styleUrl: './project-list.component.scss',
})
@UntilDestroy()
export class ProjectListComponent implements OnInit {
  @Input({ required: true }) userProjectId = '';

  private readonly projectFacade = new ProjectFacade();

  protected projects = this.projectFacade.projects;

  ngOnInit(): void {
    this.projectFacade.load(this.userProjectId);
  }
}
