import { Type } from "class-transformer"; import { ArrayMinSize, IsArray, IsEmail, IsIn, IsInt, IsNumber, IsOptional, IsString, Min, MinLength, ValidateNested, } from "class-validator"; import { QuoteItemInputDto } from "./quote-item-input.dto.js"; /** * Every edit resubmits the full commercial state (contractPeriod, items, * etc.) rather than a sparse patch — the service always recomputes the * entire pricing picture together (pricing.ts), so a partial edit that * only touched `notes` would still need the rest of the state to * recompute against; simplest and safest is to require it every time, * matching how the legacy's own edit screen always resubmits the whole * form. `resellerId` is intentionally absent — not changeable post-creation. */ export class UpdateQuoteDto { @IsOptional() @IsString() clientName?: string; @IsOptional() @IsString() clientCompany?: string; @IsOptional() @IsEmail() clientEmail?: string; @IsOptional() @IsString() clientPhone?: string; @IsIn([0, 12, 24, 36, 48]) contractPeriod!: number; @IsOptional() @IsInt() @Min(0) fidelityPeriod?: number; @IsArray() @ArrayMinSize(1) @ValidateNested({ each: true }) @Type(() => QuoteItemInputDto) items!: QuoteItemInputDto[]; @IsOptional() @IsNumber() @Min(0) implGeral?: number; @IsOptional() @IsNumber() @Min(0.01) proposedMonthlyTotal?: number; @IsOptional() @IsIn(["À vista", "1+1", "1+2"]) implPaymentCondition?: string; @IsOptional() @IsString() @MinLength(0) notes?: string; }