import mongoose, { Types } from "mongoose"; const { Schema } = mongoose; const SessionsSchema = new Schema({ teacherId: { type: Types.ObjectId, required: true }, userId: { type: Types.ObjectId, required: false }, startTime: { type: Date, }, endTime: { type: Date, }, status: { type: String, enum: ['BOOKED', 'AVAILABLE', 'COMPLETED'], default: 'AVAILABLE', required: true }, completedAt: { type: Date } }, { timestamps: true }); SessionsSchema.index({ userId: 1 }); SessionsSchema.index({ status: 1, startTime: 1 }); const Sessions = mongoose.model('sessions', SessionsSchema); export default Sessions;