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

export type ProjectDocument = Project & Document;

@Schema({ timestamps: true })
export class Project {
  @Prop({ default: 'New Project' })
  name: string;

  @Prop({ type: mongoose.Schema.Types.Mixed })
  elements: any[];

  @Prop({ type: mongoose.Schema.Types.Mixed })
  extras: any;

  @Prop({ type: mongoose.Schema.Types.Mixed })
  paint: any;

  @Prop({ type: mongoose.Schema.Types.ObjectId, ref: 'User', require: true })
  creator: string;

  @Prop({ type: mongoose.Schema.Types.ObjectId, ref: 'Quote' })
  quote: string;

  @Prop({ type: mongoose.Schema.Types.Mixed })
  adminVersion: any;
}

export const ProjectSchema = SchemaFactory.createForClass(Project);
