import { PaginatedSerializationClass } from '@humand-packages/common';
import { TimeTrackingCategorizedHourWithUserData } from '../../business/models/timeTracking/timeTrackingCategorizedHour';
import { TimeTrackingCategorizedHourStatus } from '../../infrastructure/constants/timeTracking/categorizedHourStatus';

export interface CategorizedHourDTO {
    id: string;
    instanceId: number;
    userId: number;
    employeeInternalId: string | null;
    fullName: string | null;
    profilePicture: string | null;
    hourCategoryId: number;
    hourCategoryName: string;
    dateString: string;
    hours: number;
    note: string | null;
    status: TimeTrackingCategorizedHourStatus;
    currentStepId: string | null;
    isLoggedUserPotentialApprover: boolean;
    isStatusOverridden: boolean;
}

export class TimeTrackingCategorizedHoursSC extends PaginatedSerializationClass<TimeTrackingCategorizedHourWithUserData, CategorizedHourDTO> {
    serialize(serializableObject: TimeTrackingCategorizedHourWithUserData): CategorizedHourDTO {
        return {
            currentStepId: serializableObject.currentStepId,
            dateString: serializableObject.dateString,
            employeeInternalId: serializableObject.employeeInternalId,
            fullName: serializableObject.fullName,
            hourCategoryId: serializableObject.hourCategoryId,
            hourCategoryName: serializableObject.hourCategoryName,
            hours: serializableObject.hours,
            id: serializableObject.id,
            instanceId: serializableObject.instanceId,
            isLoggedUserPotentialApprover: serializableObject.isLoggedUserPotentialApprover,
            isStatusOverridden: serializableObject.isStatusOverridden,
            note: serializableObject.note ?? null,
            profilePicture: serializableObject.profilePicture ?? null,
            status: serializableObject.status,
            userId: serializableObject.userId,
        };
    }
}
