forked from Yara724/api
235 lines
5.8 KiB
TypeScript
235 lines
5.8 KiB
TypeScript
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";
|
|
|
|
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()
|
|
desc: string;
|
|
|
|
// CAR_BODY specific fields
|
|
@ApiPropertyOptional({
|
|
description: "Date of accident (for CAR_BODY type only)",
|
|
example: "2025-12-08"
|
|
})
|
|
accidentDate?: Date;
|
|
|
|
@ApiPropertyOptional({
|
|
description: "Time of accident (for CAR_BODY type only)",
|
|
example: "14:30"
|
|
})
|
|
accidentTime?: string;
|
|
|
|
@ApiPropertyOptional({
|
|
enum: WeatherCondition,
|
|
description: "Weather condition at time of accident (for CAR_BODY type only)",
|
|
example: WeatherCondition.CLEAR
|
|
})
|
|
weatherCondition?: WeatherCondition;
|
|
|
|
@ApiPropertyOptional({
|
|
enum: RoadCondition,
|
|
description: "Road condition at time of accident (for CAR_BODY type only)",
|
|
example: RoadCondition.DRY
|
|
})
|
|
roadCondition?: RoadCondition;
|
|
|
|
@ApiPropertyOptional({
|
|
enum: LightCondition,
|
|
description: "Light condition at time of accident (for CAR_BODY type only)",
|
|
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 {
|
|
@ApiProperty({ enum: BlameRequestType })
|
|
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;
|
|
}
|
|
}
|