import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger"; import { IsBoolean, IsNotEmpty, IsOptional, IsString, ValidateNested, } from "class-validator"; import { Type } from "class-transformer"; class PlateV6Dto { @ApiProperty({ example: "44", description: "Left two digits" }) @IsString() @IsNotEmpty() leftDigits: string; @ApiProperty({ example: "ب", description: "Center alphabet letter" }) @IsString() @IsNotEmpty() centerAlphabet: string; @ApiProperty({ example: "111", description: "Center three digits" }) @IsString() @IsNotEmpty() centerDigits: string; @ApiProperty({ example: "22", description: "Right two digits (Iran region code)" }) @IsString() @IsNotEmpty() ir: string; } /** * Inquiry body for the V6 call-center flow. * Same as V3 but without `sheba` — the user adds their own IBAN later via the link. */ export class RunCallCenterInquiryV6Dto { @ApiProperty({ type: PlateV6Dto, description: "Plate segments — Tejarat block / third-party inquiry.", }) @ValidateNested() @Type(() => PlateV6Dto) plate: PlateV6Dto; @ApiProperty({ example: "1234567890", description: "National code of the policyholder (insurer)" }) @IsString() @IsNotEmpty() nationalCodeOfInsurer: string; @ApiProperty({ example: "1234567890", description: "National code of the driver" }) @IsString() @IsNotEmpty() nationalCodeOfDriver: string; @ApiProperty({ example: true, description: "Whether the driver is the same person as the insurer" }) @IsBoolean() driverIsInsurer: boolean; @ApiProperty({ example: 13780624, description: "Insurer birth date (Jalali)" }) insurerBirthday: number | string; @ApiPropertyOptional({ example: 13780624, description: "Driver birth date (Jalali). Required when driverIsInsurer is false.", }) @IsOptional() driverBirthday?: number | string | null; @ApiPropertyOptional({ example: "123456789", description: "Driver license (required when driverIsInsurer is false).", }) @IsOptional() @IsString() driverLicense?: string; @ApiPropertyOptional({ example: "123456789", description: "Insurer license (required when driverIsInsurer is true).", }) @IsOptional() @IsString() insurerLicense?: string; }