import { Prop, Schema, SchemaFactory } from "@nestjs/mongoose"; import { CarDamagePartModel, CarDamagePartOtherModel } from "./car-parts.schema"; @Schema({ _id: false }) export class SelectedOuterPartV2 { @Prop({ type: Number }) id: number; @Prop({ type: String }) key: string; @Prop({ type: String }) side: string; } export const SelectedOuterPartV2Schema = SchemaFactory.createForClass(SelectedOuterPartV2); @Schema({ _id: false }) export class ClaimDamageSelection { /** * V2: Array of selected damaged outer car part names * Examples: ['hood', 'front_right_door', 'rear_bumper'] */ @Prop({ type: [String], default: [] }) selectedParts?: string[]; /** Structured selected outer parts with id + side for better downstream handling. */ @Prop({ type: [SelectedOuterPartV2Schema], default: [] }) selectedOuterParts?: SelectedOuterPartV2[]; /** * V2: Array of selected other (non-body) damaged parts * Examples: ['engine', 'suspension', 'headlight'] */ @Prop({ type: [String], default: [] }) otherParts?: string[]; /** * Legacy fields - kept for backward compatibility */ @Prop({ type: [CarDamagePartModel] }) legacyParts?: CarDamagePartModel[]; @Prop({ type: CarDamagePartOtherModel }) legacyOtherParts?: CarDamagePartOtherModel; } export const ClaimDamageSelectionSchema = SchemaFactory.createForClass(ClaimDamageSelection);