const mongoose = require("mongoose");
const Schema = mongoose.Schema;

const adminSchema = new Schema({
    email: {
        type: String,
        required: true
    },
    password:{
        type: String,
        requried: true
    },
    profileImage:{
        type: String
    },
    fullName:{
        type: String
    },
    DOB:{
        type: String
    },
    gender:{
        type: String,
        enum: ["Male", "Female"]
    },
    phone:{
        type: Number
    },
    bio:{
        type: String
    },
    location:{
        type: {
            type: String,
            enum:["Point"],
        },
        coordinates: {
            type: [Number],
        },
        address: {
            type: String
        }
    },
    longitude:{
        type: Number
    },
    latitude:{
        type: Number
    },
    postalCode:{
        type: Number
    },
    country:{
        type: String
    },
    state:{
        type: String
    },
    city:{
        type: String
    },
    profileCreated:{
        type: Boolean,
        default: false
    },
    shopCreated: {
        type: Boolean,
        default: false
    }, 
    profilePath:{
        type: String
    },
    shopProfilepath:{
        type: String
    },
    shopId:{
        type: Schema.Types.ObjectId,
        ref: "Shop"
    } 
});

adminSchema.index({ location: '2dsphere'});

const adminModel = mongoose.model("Admin", adminSchema);
module.exports = adminModel;