import { Weekday } from "prisma/postgres/generated/prisma/client/postgres/client";
import { ArrayMinSize, IsArray, IsBoolean, IsEnum, IsInt, IsOptional, IsString, Matches} from "class-validator";
import { HH_MM_REGEX } from "src/common/utils/constants.utils";

export class SchedulePresetsDto {
    @IsInt() id!: number;
    @IsString() name!: string;
    @IsArray() @ArrayMinSize(1) shifts: SchedulePresetShiftsDto[];
}

export class SchedulePresetShiftsDto {
    @IsInt() preset_id!: number;
    @IsEnum(Weekday) week_day!: Weekday;
    @IsString() type!: string;
    @IsString() @Matches(HH_MM_REGEX) start_time!: string;
    @IsString() @Matches(HH_MM_REGEX) end_time!: string;
    @IsOptional() @IsBoolean() is_remote?: boolean;
}

export const WEEKDAY_MAP: Record<Weekday, number> = {
    SUN: 0,
    MON: 1,
    TUE: 2,
    WED: 3,
    THU: 4,
    FRI: 5,
    SAT: 6,
};