import { IsNotEmpty, IsOptional, IsString, IsBoolean, IsUUID, IsArray, IsNumber, MaxLength, Min, IsEmail, ArrayMinSize } from 'class-validator';

export class CreateSupplierDto {
  @IsUUID() @IsNotEmpty()
  destination_id: string;

  @IsArray() @ArrayMinSize(1, { message: 'Select at least one supplier type' })
  @IsString({ each: true })
  supplier_types: string[];

  // --- Common ---
  @IsString() @IsNotEmpty() @MaxLength(255)
  name: string;

  @IsString() @IsNotEmpty() @MaxLength(255)
  contact_person: string;

  @IsString() @IsNotEmpty() @MaxLength(20)
  phone: string;

  @IsEmail() @IsOptional()
  email?: string;

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

  @IsString() @IsOptional() @MaxLength(500)
  photo_url?: string;

  @IsString() @IsOptional()
  address?: string;

  // --- Transport details (per-type) ---
  @IsArray() @IsOptional()
  @IsString({ each: true })
  linked_transport_services?: string[];

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

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

  @IsNumber() @IsOptional() @Min(0)
  fleet_count?: number;

  @IsString() @IsOptional()
  transport_notes?: string;

  // --- Activity details (per-type) ---
  @IsArray() @IsOptional()
  @IsString({ each: true })
  linked_activities?: string[];

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

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

  @IsNumber() @IsOptional() @Min(0)
  capacity?: number;

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

  @IsString() @IsOptional()
  activity_notes?: string;

  @IsBoolean() @IsOptional()
  is_active?: boolean;
}
