import mongoose from "mongoose";

const userSchema = new mongoose.Schema({
    username: {
        type: String,
        required: true,
        unique: true
    },
    password: {
        type: String,
        required: true
    },
    age: {
        type: Number,
        required: true
    },
    role: {
        type: String,
        required: true,
        enum: ["librarian", "student"],
        default: "student"
    }
}, { timestamps: true });

const User = mongoose.model("User", userSchema);

export default User;
