import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; import { IsString, IsNotEmpty, IsArray, IsBoolean, IsOptional, ValidateNested, IsEnum, } from 'class-validator'; import { Type } from 'class-transformer'; import { ClaimRequiredDocumentType } from 'src/Types&Enums/claim-request-management/required-document-type.enum'; import { DamagedPartItem } from 'src/claim-request-management/dto/capture-requirements-v2.dto'; export class CarPartDamageV2Dto { @ApiProperty({ example: 'left' }) @IsString() side: string; @ApiProperty({ example: 'front_door' }) @IsString() part: string; } export class PartPricingV2Dto { @ApiProperty({ example: 'part-001' }) @IsString() @IsNotEmpty() partId: string; @ApiProperty({ type: CarPartDamageV2Dto }) @ValidateNested() @Type(() => CarPartDamageV2Dto) carPartDamage: CarPartDamageV2Dto; @ApiProperty({ example: 'Minor' }) @IsString() typeOfDamage: string; @ApiProperty({ example: '5000000' }) @IsString() price: string; @ApiProperty({ example: '2000000' }) @IsString() salary: string; @ApiProperty({ example: '7000000' }) @IsString() totalPayment: string; @ApiPropertyOptional({ example: '500000' }) @IsOptional() @IsString() daghi?: string; @ApiProperty({ example: false }) @IsBoolean() factorNeeded: boolean; } export class SubmitExpertReplyV2Dto { @ApiProperty({ example: 'Front door and hood have severe paint damage' }) @IsString() @IsNotEmpty() description: string; @ApiProperty({ type: [PartPricingV2Dto] }) @IsArray() @ValidateNested({ each: true }) @Type(() => PartPricingV2Dto) parts: PartPricingV2Dto[]; } export class ClaimSubmitResendV2Dto { @ApiPropertyOptional({ description: "Instructions for the owner. At least one of description, resendDocuments, or resendCarParts must be non-empty.", }) @IsOptional() @IsString() resendDescription?: string; @ApiPropertyOptional({ type: [String], enum: ClaimRequiredDocumentType, description: "Extra document keys to upload (may include types not in the initial claim form).", }) @IsOptional() @IsArray() @IsEnum(ClaimRequiredDocumentType, { each: true }) resendDocuments?: ClaimRequiredDocumentType[]; @ApiPropertyOptional({ type: [DamagedPartItem] }) @IsOptional() @IsArray() @ValidateNested({ each: true }) @Type(() => DamagedPartItem) resendCarParts?: DamagedPartItem[]; }