import { PaginatedSerializationClass } from '@humand-packages/common';
import { Region } from '../../../regions/business/models/region';
import { ShiftRegionDTO } from '../dtos/shiftRegionDTO';
import { ShiftSiteDTO } from '../dtos/shiftSiteDTO';

export class ShiftRegionSC extends PaginatedSerializationClass<Region, ShiftRegionDTO> {
    serialize(region: Region): ShiftRegionDTO {
        return new ShiftRegionDTO(
            region.getId(),
            region.getTitle(),
            region.getSites()?.map((site) => new ShiftSiteDTO(site.getId(), site.getName())) ?? [],
        );
    }
}
