import mongoose from "mongoose";


const userSchema = new mongoose.Schema({

    employeeId:{
        type:Number,
        required:true,
        unique:true,
    },

    userName:{
        type:String,
        required:true,
        unique:true,
    },

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

    roleId:{
        type:mongoose.Schema.Types.ObjectId,
        ref:"Role",
        required:true
    },

    active:{
        type:Boolean,
        default:true
    },

    lastLogin:{
        type:Date

    }
},

{
    timestamps:true
}

);

export default mongoose.model("User", userSchema);