import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger"; import { Types } from "mongoose"; import { AddPlateDto } from "src/profile/dto/user/AddPlateDto"; import { StepsEnum } from "src/Types&Enums/blame-request-management/steps.enum"; import { WeatherCondition, RoadCondition, LightCondition, } from "src/Types&Enums/blame-request-management/accident-conditions.enum"; import { BlameRequestType } from "src/Types&Enums/blame-request-management/blameRequestType.enum"; import { IsEnum } from "class-validator"; export class InitialFormDto { @ApiProperty({ required: false, default: false }) expertOpinion?: boolean; @ApiProperty({ required: false, default: false }) imDamaged?: boolean; @ApiProperty({ required: true, default: false }) imGuilty?: boolean; } export class CarBodyFormDto { @ApiProperty({ required: false, default: false }) car?: boolean; @ApiProperty({ required: false, default: false }) object?: boolean; } export class CarBodySecondForm { @ApiProperty({ required: false, default: false }) imDamaged?: boolean; @ApiProperty({ required: true, default: false }) imGuilty?: boolean; } export class FirstPartyFileDto { @ApiProperty() descriptions?: string; @ApiProperty() voices?: string; @ApiPropertyOptional({ type: String }) firstPartyVideoId?: string; } export class DescriptionDto { @ApiProperty({ description: "Accident description (required for all types)" }) desc: string; @ApiPropertyOptional({ description: "CAR_BODY only. Ignored for THIRD_PARTY.", example: "2025-12-08", }) accidentDate?: Date; @ApiPropertyOptional({ description: "CAR_BODY only. Ignored for THIRD_PARTY.", example: "14:30", }) accidentTime?: string; @ApiPropertyOptional({ enum: WeatherCondition, description: "CAR_BODY only. Ignored for THIRD_PARTY.", example: WeatherCondition.CLEAR, }) weatherCondition?: WeatherCondition; @ApiPropertyOptional({ enum: RoadCondition, description: "CAR_BODY only. Ignored for THIRD_PARTY.", example: RoadCondition.DRY, }) roadCondition?: RoadCondition; @ApiPropertyOptional({ enum: LightCondition, description: "CAR_BODY only. Ignored for THIRD_PARTY.", example: LightCondition.DAYLIGHT, }) lightCondition?: LightCondition; } /** * THIRD_PARTY description step: only desc is accepted. */ export class ThirdPartyDescriptionDto { @ApiProperty({ description: "Accident description" }) desc: string; } /** * CAR_BODY description step: desc + accident date/time and conditions required. */ export class CarBodyDescriptionDto { @ApiProperty({ description: "Accident description" }) desc: string; @ApiProperty({ description: "Date of accident", example: "2025-12-08" }) accidentDate: Date; @ApiProperty({ description: "Time of accident", example: "14:30" }) accidentTime: string; @ApiProperty({ enum: WeatherCondition, example: WeatherCondition.CLEAR }) weatherCondition: WeatherCondition; @ApiProperty({ enum: RoadCondition, example: RoadCondition.DRY }) roadCondition: RoadCondition; @ApiProperty({ enum: LightCondition, example: LightCondition.DAYLIGHT }) lightCondition: LightCondition; } export class FirstPartyDetail { // @ApiProperty({ type: String }) firstPartyId?: Types.ObjectId; // @ApiProperty({ type: String }) firstPartyPhoneNumber?: string; // @ApiProperty({ type: String }) firstPartyClientId?: string; @ApiProperty({ type: AddPlateDto, description: "first add plate and send plate id to this field", }) firstPartyPlate?: AddPlateDto; @ApiProperty() firstPartyFile?: FirstPartyFileDto; } export class SecondPartyDetail { @ApiProperty({ type: String }) secondPartyId?: Types.ObjectId; @ApiProperty({ type: String }) secondPartyPhoneNumber?: string; @ApiProperty({ type: String }) secondPartyClientId?: string; @ApiProperty({ type: String, description: "first add plate and send plate id to this field", }) secondPartyPlateId?: Types.ObjectId; @ApiProperty({ type: String }) secondPartyVideoId?: string; } export class LocationDto { @ApiProperty({ type: Number, required: true }) lat: number; @ApiProperty({ type: Number, required: true }) lon: number; } // export class CreateRequestDto { // @ApiProperty({ type: String, required: false }) // type?: "THIRD_PARTY" | "CAR_BODY"; // } /** * V2 create blame request (new model `BlameRequest`). */ export class CreateBlameRequestDtoV2 { @IsEnum(BlameRequestType) @ApiProperty({ enum: BlameRequestType, description: "Type of blame request" }) type: BlameRequestType; } /** * V2 step: FIRST_BLAME_CONFESSION */ export class BlameConfessionDtoV2 { @ApiProperty({ required: false, default: false }) expertOpinion?: boolean; @ApiProperty({ required: false, default: false }) imDamaged?: boolean; @ApiProperty({ required: true, default: false }) imGuilty?: boolean; } // export class DocsOfThisFile { // @ApiProperty() // firstPartyFile?: FirstPartyFileDto; // } export class CreateRequestManagementDto { @ApiPropertyOptional({ required: false, description: "first step" }) initialForm?: InitialFormDto; @ApiPropertyOptional({ required: false, description: "first step" }) firstPartyDetails?: FirstPartyDetail; // @ApiPropertyOptional({ required: false, description: "second step call" }) // docsOFirstParty?: DocsOfThisFile; @ApiPropertyOptional({ required: false }) secondPartyDetails?: SecondPartyDetail; @ApiPropertyOptional({ required: false, description: "third step call" }) locationForm?: LocationDto; @ApiProperty({ type: "string", format: "binary", required: false }) firstPartyVideoId: Express.Multer.File; } // type: "object", // properties: { // file: { // type: "string", // format: "binary", // }, // }, export class CreateRequestManagementInitialFormStep { step?: StepsEnum; userId?: Types.ObjectId; nextStep?: StepsEnum; message?: string; requestId?: Types.ObjectId; @ApiPropertyOptional({ required: false, description: "first step" }) initialForm?: InitialFormDto; constructor(userId, reqId, step, nextStep, message?) { this.requestId = reqId; this.userId = userId; this.step = step; this.nextStep = nextStep; this.message = message; } } export class RequestManagementDtoRs { step?: StepsEnum; firstPartyUserId?: Types.ObjectId; secondPartyUserId?: Types.ObjectId | null; nextStep?: StepsEnum; message?: string; requestId?: Types.ObjectId; claimFile?: Types.ObjectId | null; constructor( firstPartyUser, secondPartyUserId, step, nextStep, message?, requestId?, claimFile = null, ) { this.requestId = requestId; this.firstPartyUserId = firstPartyUser; this.secondPartyUserId = secondPartyUserId; this.step = step; this.nextStep = nextStep; this.message = message; this.claimFile = claimFile; } }