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

export interface IPlanSuscription {
    userId: string;
    planId: string;
    startDate: Date;
    endDate: Date;
}

export interface IPlanSuscriptionDocument extends IPlanSuscription, Document {}

export class PlanSuscriptions {
    schema: Schema;
    planSuscriptionList: Model<IPlanSuscriptionDocument>;

    constructor() {
        this.schema = new Schema({
            userId: { type: Schema.Types.ObjectId, required: true },
            planId: { type: Schema.Types.ObjectId, required: true },
            startDate: { type: Date, required: true },
            endDate: { type: Date, required: true },
        });

        this.planSuscriptionList = model<IPlanSuscriptionDocument>("PlanSuscription", this.schema);
    }
}
