import { Component, Input, OnInit } from '@angular/core';
import { TitleCasePipe } from '@angular/common';
import { UntilDestroy } from '@ngneat/until-destroy';
import { SectorFacade } from '@app/ui/sectors/sector.facade';

@Component({
  selector: 'app-chips',
  standalone: true,
  imports: [TitleCasePipe],
  templateUrl: './chips.component.html',
  styleUrl: './chips.component.scss',
})
@UntilDestroy()
export class ChipsComponent implements OnInit {
  @Input({ required: true }) sectorId: string | null = null;

  private readonly sectorFacade = new SectorFacade();
  protected sector = this.sectorFacade.sector;

  ngOnInit(): void {
    if (this.sectorId) {
      this.sectorFacade.loadOne(this.sectorId);
    }
  }
}
