/***
 *
 * @description This model represent the gym workers collection schema in mongodb
 * * source : https://mongoosejs.com/docs/guide.html
 */
import mongoose, { Model } from 'mongoose';
import { IWorkersSchema } from '@/types/IDB';
// define the schema
const workersSchema = new mongoose.Schema<IWorkersSchema>({
    firstName: String,
    lastName: String,
    jobType: String,
    monthlySalary: String,
    gendre: String,
    phone: String,
    email: String,
    address: String,
}, { timestamps: true });
// export the model
// Clear any existing model to avoid schema conflicts
if (mongoose.models.workers) {
    delete mongoose.models.workers;
}

const workerModel: Model<IWorkersSchema> = mongoose.model<IWorkersSchema>('workers', workersSchema);
export default workerModel