1
0
forked from Yara724/api
Files
yara724-api/src/claim-request-management/dto/capture-requirements-v2.dto.ts

184 lines
3.8 KiB
TypeScript

import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { IsInt, IsOptional } from 'class-validator';
/**
* DTO for required document item
*/
export class RequiredDocumentItem {
@ApiProperty({
description: 'Document key/type',
example: 'car_green_card',
})
key: string;
@ApiProperty({
description: 'Display label in Farsi',
example: 'کارت سبز خودرو',
})
label_fa: string;
@ApiProperty({
description: 'Display label in English',
example: 'Car Green Card',
})
label_en: string;
@ApiProperty({
description: 'Whether this document has been uploaded',
example: false,
})
uploaded: boolean;
@ApiProperty({
description: 'Category of the document',
example: 'general',
enum: ['general', 'damaged_party', 'guilty_party'],
})
category: string;
}
/**
* DTO for car angle item
*/
export class CarAngleItem {
@ApiProperty({
description: 'Angle key',
example: 'front',
enum: ['front', 'back', 'left', 'right'],
})
key: string;
@ApiProperty({
description: 'Display label in Farsi',
example: 'جلو',
})
label_fa: string;
@ApiProperty({
description: 'Display label in English',
example: 'Front',
})
label_en: string;
@ApiProperty({
description: 'Whether this angle has been captured',
example: false,
})
captured: boolean;
}
/**
* DTO for damaged part item
*/
export class DamagedPartItem {
@ApiProperty({
description:
'Side-agnostic part name (matches catalog suffix); use with `side` to disambiguate',
example: 'backfender',
})
name: string;
@ApiPropertyOptional({
description: 'Vehicle side / region (left, right, front, back, top)',
example: 'left',
})
side?: string;
@ApiProperty({
description: 'Display label in Farsi',
example: 'کاپوت',
})
label_fa: string;
@ApiPropertyOptional({
description: 'Deprecated: same as `name` (kept for older clients)',
example: 'backfender',
})
key?: string;
@ApiProperty({
description: 'Display label in English',
example: 'Hood',
})
label_en: string;
@ApiProperty({
description: 'Whether this part has been captured',
example: false,
})
captured: boolean;
/** Static catalog id (same as `damagedParts[].id` in capture requirements) when the part comes from the outer-parts catalog. */
@ApiPropertyOptional({ example: 12 })
@IsOptional()
@IsInt()
id?: number;
}
/**
* Response DTO for capture requirements V2
*/
export class GetCaptureRequirementsV2ResponseDto {
@ApiProperty({
description: 'Claim request ID',
example: '507f1f77bcf86cd799439011',
})
claimRequestId: string;
@ApiProperty({
description: 'Public ID',
example: 'A14235',
})
publicId: string;
@ApiProperty({
description: 'Current workflow step',
example: 'UPLOAD_REQUIRED_DOCUMENTS',
})
currentStep: string;
@ApiProperty({
description: 'List of required documents to upload',
type: [RequiredDocumentItem],
})
requiredDocuments: RequiredDocumentItem[];
@ApiProperty({
description: 'List of car angles to capture',
type: [CarAngleItem],
})
carAngles: CarAngleItem[];
@ApiProperty({
description: 'List of damaged parts to capture',
type: [DamagedPartItem],
})
damagedParts: DamagedPartItem[];
@ApiProperty({
description: 'Total number of items remaining',
example: 18,
})
totalRemaining: number;
@ApiProperty({
description: 'Summary of progress',
example: {
documentsUploaded: 2,
documentsTotal: 13,
anglesCapture: 0,
anglesTotal: 4,
partsCapture: 0,
partsTotal: 3,
},
})
progress: {
documentsUploaded: number;
documentsTotal: number;
anglesCaptured: number;
anglesTotal: number;
partsCaptured: number;
partsTotal: number;
};
}