import mongoose from "mongoose";

const approvalSchema =
new mongoose.Schema({

    referenceType:{
        type:String,
        required:true
    },

    referenceId:{
        type:mongoose.Schema.Types.ObjectId,
        required:true
    },

    approvedBy:{
        type:mongoose.Schema.Types.ObjectId,
        ref:"User"
    },

    approvedDate:{
        type:Date
    },

    status:{
        type:String,
        enum:[
            "PENDIENTE",
            "APROBADO",
            "RECHAZADO"
        ],
        default:"PENDIENTE"
    },

    comments:{
        type:String
    }

},{
    timestamps:true
});

export default mongoose.model(
    "Approval",
    approvalSchema
);