import mongoose from "mongoose";

const lpgSchema = new mongoose.Schema({
    
    requestNumber:{
        type:String,
        required:true,
        unique:true,
    },

    plant:{
        type:String,
        requiered:true,
        enum:[
            "Planta 1",
            "Planta 2"
        ]
    },

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

    requestedBy:{
        type:mongoose.Schema.Types.ObjectId,
        ref:"User",
        requeride:true
    },

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

    requestDate:{
        type:Date,
        default:Date.now,
        requiered:true
    },

    gallons:{
        type:Number,
        required:true,
    },

    pricePerGallon:{
        type:Number,
        default:0
    },

    totalAmount:{
        type:Number,
        default:0
    },

    comments:{
        type:String
    },

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

        default:"PENDIENTE"

    }
},

    {
        timestamps:true,
        versionKey:false
    }
);

export default mongoose.model("LPG", lpgSchema);