import { SerializationClass } from '@humand-packages/common';
import { CategorizedHourCategoryCount } from '../../business/models/timeTracking/categorizedHourCategoryCount';
import { CategorizedHourCategoryCountsDTO } from '../dataTransferObjects/categorizedHourCategoryCountsDTO';

export class TimeTrackingCategorizedHourCategoryCountsSC extends SerializationClass<
    { rows: CategorizedHourCategoryCount[]; total: number },
    CategorizedHourCategoryCountsDTO
> {
    serialize(input: { rows: CategorizedHourCategoryCount[]; total: number }): CategorizedHourCategoryCountsDTO {
        return {
            hourCategoryCounts: input.rows.map((r) => ({
                hourCategoryId: r.hourCategoryId,
                hourCategoryName: r.hourCategoryName,
                count: r.count,
            })),
            total: input.total,
        };
    }
}
