import { Prop, Schema, SchemaFactory } from "@nestjs/mongoose";
import { Document, Types } from "mongoose";

export type ExerciseDocument = Exercise & Document;

@Schema({ timestamps: true, strict: true })
export class Exercise {
  @Prop({ type: Object, required: true })
  name: Record<string, string>;

  @Prop({ type: Object, required: true })
  description: Record<string, string>;

  @Prop({ type: Types.ObjectId, ref: "ExerciseCategory", default: null })
  category: Types.ObjectId | null;

  @Prop({ type: [{ type: Types.ObjectId, ref: "BodyPart" }], default: [] })
  targetedBodyParts: Types.ObjectId[];

  @Prop({ default: 1 })
  status: number;

  @Prop({ default: null })
  deleted_at: Date | null;
}

export const ExerciseSchema = SchemaFactory.createForClass(Exercise);
