import { ISO_DATE } from '@humand-packages/common';
import { Expose } from 'class-transformer';
import { IsArray, IsBoolean, IsDefined, IsInt, IsOptional, IsPositive, ValidateIf } from 'class-validator';
import { IsValidDate } from '../../../../../middlewares/dateValidator';
import { IsValidTimeSlotTuples } from '../../validators/isValidTimeSlotTuples/isValidTimeSlotTuples';
export class ShiftAssignDayEntryRequestVC {
    @IsDefined()
    @IsValidDate(ISO_DATE)
    @Expose()
    date!: string;

    // When shiftTemplateId is provided the template's time slots are used, so timeSlots is optional and ignored.
    @ValidateIf((o: ShiftAssignDayEntryRequestVC) => o.shiftTemplateId == null)
    @IsDefined()
    @IsArray()
    @IsValidTimeSlotTuples({ message: 'Each timeSlot must be a [start, end] in HH:mm format' })
    @Expose()
    timeSlots!: [string, string][];

    @IsDefined()
    @IsBoolean()
    @Expose()
    isWorkday!: boolean;

    @IsOptional()
    @IsInt()
    @IsPositive()
    @Expose()
    shiftTemplateId?: number;
}
