forked from Yara724/api
Added AI damage estimation
This commit is contained in:
@@ -0,0 +1,119 @@
|
||||
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
|
||||
import {
|
||||
IsEnum,
|
||||
IsInt,
|
||||
IsOptional,
|
||||
IsString,
|
||||
Max,
|
||||
MaxLength,
|
||||
Min,
|
||||
} from "class-validator";
|
||||
|
||||
export enum EstimatePartQuality {
|
||||
OEM = "oem",
|
||||
AFTERMARKET = "aftermarket",
|
||||
ANY = "any",
|
||||
}
|
||||
|
||||
export class CreatePriceEstimateDto {
|
||||
@ApiPropertyOptional({
|
||||
description:
|
||||
"Known current vehicle market value in RIALS; otherwise use the expert's VehicleCurrentValue or research the market.",
|
||||
example: 8000000000,
|
||||
minimum: 1,
|
||||
})
|
||||
@IsOptional()
|
||||
@IsInt()
|
||||
@Min(1)
|
||||
@Max(Number.MAX_SAFE_INTEGER)
|
||||
currentMarketValueRial?: number;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
description:
|
||||
"Vehicle model year, Jalali (e.g. 1402) or Gregorian (e.g. 2023). Overrides the damaged vehicle inquiry year.",
|
||||
example: 1402,
|
||||
})
|
||||
@IsOptional()
|
||||
@IsInt()
|
||||
@Min(1300)
|
||||
@Max(2100)
|
||||
modelYear?: number;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
example: 45000,
|
||||
description: "Odometer reading in kilometers; unknown when omitted.",
|
||||
})
|
||||
@IsOptional()
|
||||
@IsInt()
|
||||
@Min(0)
|
||||
@Max(3000000)
|
||||
mileageKm?: number;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
example: "تهران",
|
||||
description:
|
||||
"Market city, not the accident address. Omit for the Iranian market generally.",
|
||||
})
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@MaxLength(100)
|
||||
city?: string;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
enum: EstimatePartQuality,
|
||||
default: EstimatePartQuality.OEM,
|
||||
})
|
||||
@IsOptional()
|
||||
@IsEnum(EstimatePartQuality)
|
||||
partQuality?: EstimatePartQuality;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
example: "بدون رنگ و تصادف قبلی",
|
||||
description:
|
||||
"Known vehicle condition before this accident. Treat unknown history as unknown.",
|
||||
})
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@MaxLength(1000)
|
||||
vehicleCondition?: string;
|
||||
}
|
||||
|
||||
export class PriceEstimateJobDto {
|
||||
@ApiProperty({ example: "670000000000000000000001" }) estimateId: string;
|
||||
@ApiProperty() claimRequestId: string;
|
||||
@ApiProperty({ enum: ["queued", "processing", "completed", "failed"] })
|
||||
status: string;
|
||||
@ApiProperty({
|
||||
description:
|
||||
"Whether new jobs/retries are enabled. Existing estimates remain readable when disabled.",
|
||||
})
|
||||
enabled: boolean;
|
||||
@ApiProperty() attempts: number;
|
||||
@ApiProperty() model: string;
|
||||
@ApiProperty() promptVersion: string;
|
||||
@ApiProperty() createdAt: Date;
|
||||
@ApiPropertyOptional() completedAt?: Date;
|
||||
@ApiProperty({
|
||||
description:
|
||||
"Non-personal vehicle/parts input snapshot and included photo keys; no local paths or image bytes.",
|
||||
type: Object,
|
||||
})
|
||||
input: object;
|
||||
@ApiPropertyOptional({
|
||||
description:
|
||||
"Advisory estimate: part price ranges, source evidence, computed repair totals and market depreciation. All amounts in RIALS; unknown amounts are null.",
|
||||
type: Object,
|
||||
})
|
||||
result?: object;
|
||||
@ApiPropertyOptional({
|
||||
type: Object,
|
||||
description:
|
||||
"Sanitized failure code/message, without upstream credentials or payload.",
|
||||
})
|
||||
error?: object;
|
||||
@ApiPropertyOptional({
|
||||
type: Object,
|
||||
description: "OpenAI response ID, token usage and number of web searches.",
|
||||
})
|
||||
provider?: object;
|
||||
}
|
||||
Reference in New Issue
Block a user