import { Prop, Schema, SchemaFactory } from "@nestjs/mongoose"; import { Schema as MongooseSchema } from "mongoose"; import { CarDamagePartModel, CarDamagePartOtherModel } from "./car-parts.schema"; @Schema({ _id: false }) export class ClaimDamageSelection { /** * V2: Selected outer damaged parts (ordered). Prefer objects * `{ id, name, side, label_fa, catalogKey? }`; legacy string keys are still accepted until migrated. */ @Prop({ type: [MongooseSchema.Types.Mixed], default: [] }) selectedParts?: unknown[]; /** * 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);