import { type ObjectId, Schema, model, Model, Document } from 'mongoose'; export interface FormElementsType { id: string; label: string; type: string; required: boolean; options?: { label: string; value: string }[]; } interface FormI extends Document { name: string; elements: FormElementsType[]; isActive: boolean; user: ObjectId; } export interface FormModelI extends Model {} const formSchema = new Schema( { name: { type: String, required: true, }, elements: Array, isActive: { type: Boolean, default: true, }, user: { type: Schema.ObjectId, ref: 'User', required: true, }, }, { timestamps: true, } ); const formModel = model('Form', formSchema); export default formModel;