import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger"; import { IsBoolean, IsNotEmpty, IsOptional, IsString, ValidateNested, } from "class-validator"; import { Type } from "class-transformer"; class PlateV3Dto { @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; } /** * Body for `POST run-inquiries/:requestId`. * First call = guilty party (+ auto claim). Second call = damaged party (THIRD_PARTY only). */ export class RunInquiriesV3Dto { @ApiProperty({ type: PlateV3Dto, description: "Plate segments — Tejarat block / third-party inquiry.", }) @ValidateNested() @Type(() => PlateV3Dto) plate: PlateV3Dto; @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: "IR123456789012345678901234", description: "Sheba (IBAN). Required on the damaged party call (CAR_BODY first call; THIRD_PARTY second call).", }) @IsOptional() @IsString() sheba?: string; @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; }