import {
  IsNumber,
  IsOptional,
  IsString,
  IsUUID,
  IsArray,
  MaxLength,
  Min,
  ValidateNested,
} from 'class-validator';
import { Type } from 'class-transformer';
import { ItemSupplierInputDto } from './supplier-input.dto';

/**
 * PatchSpecialItemDto — partial update for special-line supplier
 * assignment and cost. Same shape as PatchHotelItemDto; special items
 * are ad-hoc one-off services so no fan-out logic either.
 */
export class PatchSpecialItemDto {
  @IsUUID() @IsOptional() supplier_id?: string | null;
  @IsString() @IsOptional() @MaxLength(255) supplier_name_text?: string | null;
  @IsString() @IsOptional() @MaxLength(20) supplier_phone_text?: string | null;
  @IsString() @IsOptional() @MaxLength(1000) comments?: string | null;
  @IsNumber() @IsOptional() @Min(0) actual_supplier_cost?: number | null;

  /** Multi-supplier assignment — see AssignTransportItemDto. */
  @IsArray()
  @IsOptional()
  @ValidateNested({ each: true })
  @Type(() => ItemSupplierInputDto)
  suppliers?: ItemSupplierInputDto[];
}
