import { IsArray, IsBoolean, IsDateString, IsEmail, IsInt, IsNotEmpty, IsOptional, IsPositive, IsString } from 'class-validator';
import { Type } from 'class-transformer';
import { PaidTimeOffDto } from 'src/time-and-attendance/paid-time-off/paid-time-off.dto';

export class EmployeeDetailedDto {
    @IsString() @IsNotEmpty() first_name: string;
    @IsString() @IsNotEmpty() last_name: string;
    @IsString() @IsOptional() employee_full_name: string;
    @IsString() @IsOptional() supervisor_full_name: string;
    @IsOptional() @IsBoolean() is_supervisor: boolean;
    @IsString() company_name: string;
    @IsString() @IsOptional() job_title: string;
    @IsEmail() @IsOptional() email: string;
    @IsString() phone_number: string;
    @IsDateString() first_work_day: string;
    @IsInt() daily_expected_hours: number;
    @IsDateString() @IsOptional() last_work_day?: string | null;
    @IsString() @IsOptional() residence?: string;
    @IsOptional() @Type(() => PaidTimeOffDto) paid_time_off?: Partial<PaidTimeOffDto>;
    @IsInt() @IsPositive() @Type(() => Number) external_payroll_id: number;
    @IsArray() @IsString({ each: true }) user_module_access: string[];
    @IsInt() @IsOptional() preset_id?: number; 
}

export class EmployeeDetailedUpsertDto {
    @IsString() @IsNotEmpty() first_name: string;
    @IsString() @IsNotEmpty() last_name: string;
    @IsString() @IsOptional() employee_full_name: string;
    @IsString() @IsOptional() supervisor_full_name: string;
    @IsOptional() @IsBoolean() is_supervisor: boolean;
    @IsString() company_name: string;
    @IsString() @IsOptional() job_title: string;
    @IsEmail() @IsOptional() email: string;
    @IsString() phone_number: string;
    @IsDateString() first_work_day: string;
    @IsInt() daily_expected_hours: number;
    @IsDateString() @IsOptional() last_work_day?: string | null;
    @IsString() @IsOptional() residence?: string;
    @IsOptional() @Type(() => PaidTimeOffDto) paid_time_off?: PaidTimeOffDto;
    @IsInt() @IsPositive() @Type(() => Number) external_payroll_id: number;
    @IsArray() @IsString({ each: true }) user_module_access: string[];
    @IsInt() @IsOptional() preset_id?: number; 
}
