forked from Yara724/api
216 lines
6.3 KiB
TypeScript
216 lines
6.3 KiB
TypeScript
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
import { DamageSelectedPartV2BodyDto } from './damage-selected-part-v2.dto';
|
|
|
|
/** Suggested HTTP call for the owner UI (`pathTemplate`: replace placeholders). */
|
|
export class ClaimDetailsOwnerNextActionV2Dto {
|
|
@ApiProperty({ description: 'Stable UI key', example: 'FINAL_SIGN' })
|
|
key: string;
|
|
|
|
@ApiPropertyOptional({ description: 'HTTP verb', example: 'PUT' })
|
|
method?: string;
|
|
|
|
@ApiPropertyOptional({
|
|
description: 'Path under API root',
|
|
example: 'v2/claim-request-management/request/{claimRequestId}/owner-insurer-approval/sign',
|
|
})
|
|
pathTemplate?: string;
|
|
|
|
@ApiProperty({ description: 'What this endpoint does for the user' })
|
|
description: string;
|
|
}
|
|
|
|
/** Server-derived hints: which phase the claim is in and what to offer next (owners only). */
|
|
export class ClaimDetailsOwnerGuidanceV2Dto {
|
|
@ApiProperty({
|
|
description: 'Machine-readable phase',
|
|
enum: [
|
|
'COMPLETED',
|
|
'REJECTED',
|
|
'CANCELLED',
|
|
'EXPERT_RESEND',
|
|
'WAITING_DAMAGE_EXPERT',
|
|
'EXPERT_REVIEWING',
|
|
'USER_FLOW',
|
|
'UPLOAD_FACTORS',
|
|
'EXPERT_VALIDATING_FACTORS',
|
|
'SIGN_PRICED_LINES',
|
|
'INSURER_REVIEW_NEEDS_REVISION',
|
|
'FINAL_SIGN_OR_REJECT',
|
|
'INSURER_APPROVAL_FALLBACK',
|
|
],
|
|
})
|
|
phaseKey: string;
|
|
|
|
@ApiProperty({ description: 'Short headline for the current phase' })
|
|
headline: string;
|
|
|
|
@ApiPropertyOptional({ description: 'Longer UX copy' })
|
|
detail?: string;
|
|
|
|
@ApiProperty({ type: [ClaimDetailsOwnerNextActionV2Dto] })
|
|
nextActions: ClaimDetailsOwnerNextActionV2Dto[];
|
|
|
|
@ApiPropertyOptional({
|
|
description: 'Whether PUT objection is permitted (see server validation for exact rules)',
|
|
})
|
|
objectionAllowed?: boolean;
|
|
|
|
@ApiPropertyOptional({ description: 'How objection relates to priced vs factor-only lines' })
|
|
objectionHint?: string;
|
|
}
|
|
|
|
/** Active damage-expert resend request (owner must upload or acknowledge). */
|
|
export class ExpertResendDetailsV2Dto {
|
|
@ApiPropertyOptional()
|
|
resendDescription?: string;
|
|
|
|
@ApiPropertyOptional({ type: [String] })
|
|
resendDocuments?: string[];
|
|
|
|
@ApiPropertyOptional({ type: [Object] })
|
|
resendCarParts?: Array<{ key?: string; label_fa?: string; label_en?: string }>;
|
|
|
|
@ApiPropertyOptional({ description: 'Set when the owner satisfied the resend request' })
|
|
fulfilledAt?: Date;
|
|
}
|
|
|
|
export class ClaimDetailsV2ResponseDto {
|
|
@ApiProperty({ description: 'Claim case ID' })
|
|
claimRequestId: string;
|
|
|
|
@ApiProperty({ description: 'Public ID' })
|
|
publicId: string;
|
|
|
|
@ApiProperty({ description: 'Request number' })
|
|
requestNo: string;
|
|
|
|
@ApiProperty({
|
|
description:
|
|
"ClaimCaseStatus; see also `ownerGuidance` for UX. Post-expert: INSURER_REVIEW_AWAITING_OWNER_SIGN | INSURER_REVIEW_MIXED_FACTORS_PENDING | OWNER_REPAIR_FACTOR_UPLOAD_PENDING | EXPERT_VALIDATING_REPAIR_FACTORS; legacy WAITING_FOR_INSURER_APPROVAL may still appear.",
|
|
example: "OWNER_REPAIR_FACTOR_UPLOAD_PENDING",
|
|
})
|
|
status: string;
|
|
|
|
@ApiProperty({ description: 'Claim damage status' })
|
|
claimStatus: string;
|
|
|
|
@ApiProperty({ description: 'Current workflow step' })
|
|
currentStep: string;
|
|
|
|
@ApiPropertyOptional({ description: 'Next workflow step' })
|
|
nextStep?: string;
|
|
|
|
@ApiPropertyOptional({ description: 'Blame request ID' })
|
|
blameRequestId?: string;
|
|
|
|
@ApiPropertyOptional({ description: 'Blame request number' })
|
|
blameRequestNo?: string;
|
|
|
|
@ApiPropertyOptional({
|
|
description: 'Claim owner (damaged party): ids for the user and their insurer client scope',
|
|
})
|
|
owner?: {
|
|
userId: string;
|
|
clientId?: string;
|
|
userClientKey?: string;
|
|
fullName?: string;
|
|
};
|
|
|
|
@ApiPropertyOptional({ description: 'Vehicle snapshot' })
|
|
vehicle?: {
|
|
carName?: string;
|
|
carModel?: string;
|
|
carType?: string;
|
|
plate?: any;
|
|
};
|
|
|
|
@ApiPropertyOptional({
|
|
description: 'Selected outer damaged parts (ordered objects with id, name, side, label_fa)',
|
|
type: [DamageSelectedPartV2BodyDto],
|
|
})
|
|
selectedParts?: DamageSelectedPartV2BodyDto[];
|
|
|
|
@ApiPropertyOptional({ description: 'Selected other damaged parts' })
|
|
otherParts?: string[];
|
|
|
|
@ApiPropertyOptional({ description: 'Bank info (masked)' })
|
|
money?: {
|
|
sheba?: string;
|
|
nationalCodeOfOwner?: string;
|
|
};
|
|
|
|
@ApiPropertyOptional({ description: 'Required documents status (link instead of id)' })
|
|
requiredDocuments?: Record<string, { uploaded: boolean; fileUrl?: string }>;
|
|
|
|
@ApiPropertyOptional({ description: 'Car angles captured' })
|
|
carAngles?: Record<string, { captured: boolean; url?: string }>;
|
|
|
|
@ApiPropertyOptional({
|
|
description:
|
|
'Per-part capture status and URLs (array index aligns with selectedParts; includes id, name, side, label_fa)',
|
|
type: 'array',
|
|
items: {
|
|
type: 'object',
|
|
properties: {
|
|
index: { type: 'number' },
|
|
id: { type: 'number', nullable: true },
|
|
name: { type: 'string' },
|
|
side: { type: 'string' },
|
|
label_fa: { type: 'string' },
|
|
captured: { type: 'boolean' },
|
|
url: { type: 'string' },
|
|
path: { type: 'string' },
|
|
fileName: { type: 'string' },
|
|
},
|
|
},
|
|
})
|
|
damagedParts?: Array<{
|
|
index: number;
|
|
id?: number | null;
|
|
name: string;
|
|
side: string;
|
|
label_fa: string;
|
|
captured: boolean;
|
|
url?: string;
|
|
path?: string;
|
|
fileName?: string;
|
|
}>;
|
|
|
|
@ApiPropertyOptional({
|
|
description:
|
|
'Damage expert resend instructions and progress (when status is WAITING_FOR_USER_RESEND).',
|
|
})
|
|
expertResend?: ExpertResendDetailsV2Dto;
|
|
|
|
@ApiPropertyOptional({
|
|
description: "Damage expert opinion(s): initial and final (after objection).",
|
|
type: Object,
|
|
})
|
|
evaluation?: {
|
|
damageExpertReply?: unknown;
|
|
damageExpertReplyFinal?: unknown;
|
|
};
|
|
|
|
@ApiPropertyOptional({
|
|
type: ClaimDetailsOwnerGuidanceV2Dto,
|
|
description:
|
|
'Owner-only: derived headline, suggested API routes, and whether objection is plausible. Omitted when the actor is FIELD_EXPERT.',
|
|
})
|
|
ownerGuidance?: ClaimDetailsOwnerGuidanceV2Dto;
|
|
|
|
@ApiPropertyOptional({ description: 'User satisfaction rating (if submitted)' })
|
|
userRating?: {
|
|
progressSpeed: number;
|
|
registrationEase: number;
|
|
overallEvaluation: number;
|
|
comment?: string;
|
|
createdAt?: Date;
|
|
};
|
|
|
|
@ApiProperty({ description: 'Created at' })
|
|
createdAt: string;
|
|
|
|
@ApiProperty({ description: 'Updated at' })
|
|
updatedAt: string;
|
|
}
|