import { EmployeeUtforandeVerksamhetResponse } from './api/employee-utforande-verksamhet.response.model';
import { EmployeeAdress, mapResponseToEmployeeAdress } from './employee-adress.model';

export interface EmployeeUtforandeVerksamhet {
  id: number;
  name: string;
  allaAdresser: boolean;
  adresser: EmployeeAdress[];
}

export function mapResponseToEmployeeUtforandeVerksamhet(
  data: EmployeeUtforandeVerksamhetResponse
): EmployeeUtforandeVerksamhet {
  const { id, namn, allaAdresser, adresser } = data;

  return {
    id,
    name: namn,
    allaAdresser,
    adresser: adresser.map(adress => mapResponseToEmployeeAdress(adress)),
  };
}
