import mongoose, { Schema } from "mongoose";

const userPlanSchema=new Schema({
    planId:{
            type:mongoose.Schema.Types.ObjectId,
            ref:'plan',
            required:true,
            unique:true
        },
    userId:{
            type:mongoose.Schema.Types.ObjectId,
            ref:'User',
            required:true,
            unique:true
        },
        startDate:{
            type:Date,required:true
        },
        endDate:{
            type:Date,required:true
        },
        status:{
            type:String,
            enum:['active','inactive','expired'],
            default:'active'
        }
},{timestamps:true})

const UserPlan=mongoose.plan('user-plan',userPlanSchema)

export default UserPlan