const mongoose = require("mongoose");

const deliveryBoySchema = new mongoose.Schema(
    {
        name: { type: String, required: true, trim: true },

        email: {
            type: String,
            required: true,
            unique: true,
            lowercase: true,
            trim: true,
        },

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

        phone: { type: String, required: true, trim: true },

        dob: { type: Date },

        gender: {
            type: String,
            enum: ["male", "female", "other"],
            default: "male",
        },

        profileImage: { type: String, default: null },

        fcm_id: { type: String, default: null },

        licenseNumber: { type: String, default: null, trim: true },

        vehicleType: { type: String, default: null, trim: true },

        otp: String,
        otpExpire: Date,
        resetPasswordToken: String,
        resetPasswordExpire: Date,

        status: {
            type: String,
            enum: ["active", "inactive", "blocked", "pending"],
            default: "pending",
        },
    },
    { timestamps: true }
);

module.exports = mongoose.model("DeliveryBoy", deliveryBoySchema);
