import {
  IsString,
  IsUUID,
  IsOptional,
  IsDateString,
  IsEmail,
  IsEnum,
  MaxLength,
  MinLength,
} from 'class-validator';
import { EmployeeStatus } from '../entities/employee.entity';

/**
 * DTO for creating a new employee
 */
export class CreateEmployeeDto {
  @IsUUID()
  companyId: string;

  @IsString()
  @MinLength(1)
  @MaxLength(50)
  employeeNumber: string;

  @IsString()
  @MinLength(1)
  @MaxLength(100)
  firstName: string;

  @IsString()
  @MinLength(1)
  @MaxLength(100)
  lastName: string;

  @IsOptional()
  @IsUUID()
  userId?: string;

  @IsOptional()
  @IsUUID()
  partnerId?: string;

  @IsOptional()
  @IsUUID()
  departmentId?: string;

  @IsOptional()
  @IsUUID()
  jobPositionId?: string;

  @IsOptional()
  @IsUUID()
  managerId?: string;

  // Work contact
  @IsOptional()
  @IsEmail()
  @MaxLength(255)
  workEmail?: string;

  @IsOptional()
  @IsString()
  @MaxLength(50)
  workPhone?: string;

  @IsOptional()
  @IsString()
  @MaxLength(50)
  workMobile?: string;

  @IsOptional()
  @IsString()
  @MaxLength(255)
  workLocation?: string;

  // Personal data
  @IsOptional()
  @IsEmail()
  @MaxLength(255)
  personalEmail?: string;

  @IsOptional()
  @IsString()
  @MaxLength(50)
  personalPhone?: string;

  @IsOptional()
  @IsDateString()
  birthDate?: string;

  @IsOptional()
  @IsString()
  @MaxLength(20)
  gender?: string;

  @IsOptional()
  @IsString()
  @MaxLength(20)
  maritalStatus?: string;

  // Identification
  @IsOptional()
  @IsString()
  @MaxLength(50)
  identificationType?: string;

  @IsOptional()
  @IsString()
  @MaxLength(100)
  identificationNumber?: string;

  @IsOptional()
  @IsString()
  @MaxLength(50)
  taxId?: string;

  @IsOptional()
  @IsString()
  @MaxLength(50)
  socialSecurityNumber?: string;

  // Address
  @IsOptional()
  @IsString()
  @MaxLength(255)
  street?: string;

  @IsOptional()
  @IsString()
  @MaxLength(100)
  city?: string;

  @IsOptional()
  @IsString()
  @MaxLength(100)
  state?: string;

  @IsOptional()
  @IsString()
  @MaxLength(20)
  postalCode?: string;

  @IsOptional()
  @IsString()
  @MaxLength(100)
  country?: string;

  // Employment
  @IsDateString()
  hireDate: string;

  @IsOptional()
  @IsEnum(['active', 'inactive', 'on_leave', 'terminated'])
  status?: EmployeeStatus;

  // Emergency contact
  @IsOptional()
  @IsString()
  @MaxLength(255)
  emergencyContactName?: string;

  @IsOptional()
  @IsString()
  @MaxLength(50)
  emergencyContactPhone?: string;

  @IsOptional()
  @IsString()
  @MaxLength(50)
  emergencyContactRelationship?: string;

  // Metadata
  @IsOptional()
  @IsString()
  notes?: string;

  @IsOptional()
  @IsString()
  avatarUrl?: string;
}
