import { ISO_DATE } from '@humand-packages/common';
import { Expose, Type } from 'class-transformer';
import { ArrayMinSize, IsArray, IsDefined, IsNumber, ValidateNested } from 'class-validator';
import { IsValidDate } from '../../../../../middlewares/dateValidator';

export class ShiftMoveItemVC {
    @IsDefined()
    @IsNumber()
    @Expose()
    shiftAssignedShiftId!: number;

    @IsDefined()
    @IsNumber()
    @Expose()
    targetUserId!: number;

    @IsDefined()
    @IsValidDate(ISO_DATE)
    @Expose()
    targetDate!: string;
}

export class ShiftMoveVC {
    @IsDefined()
    @IsArray()
    @ArrayMinSize(1)
    @ValidateNested({ each: true })
    @Type(() => ShiftMoveItemVC)
    @Expose()
    moves!: ShiftMoveItemVC[];
}
