import { SectorPresenterModel } from '../sectors/sector.presenter.model';
import { Sector } from '@app/domain/sectors/sector.model';

export class SectorPresenter {
  toViewModel(sector: Sector): SectorPresenterModel {
    const names = sector.nom ? sector.nom.split('-') : [];
    return {
      id: sector.id,
      nom: sector.nom,
      noms: names,
    };
  }

  toViewModels(sectors: Sector[]): SectorPresenterModel[] {
    return sectors.map(this.toViewModel);
  }
}
