import { Document, Model, Schema, model } from "mongoose";

export interface IAppointment {
    companyId: string;
    start: Date;
    notificated?: boolean;
    notificationIntents?: number;
}

export interface IAppointmentDocument extends Omit<IAppointment, "id">, Document {}

export class Appointments {
    schema: Schema;
    appointmentsList: Model<IAppointmentDocument>;

    constructor() {
        this.schema = new Schema({
            companyId: { type: Schema.Types.ObjectId, required: true, ref: "Companie" },
            start: { type: Date, required: true },
            notificated: { type: Boolean, required: false },
            notificationIntents: { type: Number, required: false },
        });

        this.appointmentsList = model<IAppointmentDocument>("Appointment", this.schema);
    }
}
