const mongoose = require("mongoose");

const BatchSchema = new mongoose.Schema({
  name: {
    type: String,
    required: true,
    unique: true,
    trim: true
  },
  slug: {
    type: String,
    required: true,
    unique: true,
    lowercase: true
  },
  description: {
    type: String
  },
  class: {
    type: String,
    enum: ["Class 9", "Class 10", "Class 11", "Class 12"],
    required: true
  },
  stream: {
    type: String,
    enum: ["Medical", "Non-Medical", "Commerce", "Super-Medical", "Dropper"],
    default: null
  },
  goal: {
    type: String,
    enum: ["CBSE", "NEET", "JEE", "Nursing", "NDA", "Para-Medical", "CUET"],
    default: null
  },
  thumbnail: {
    type: String,
    default: ""
  },
  courses: [
    {
      type: mongoose.Schema.Types.ObjectId,
      ref: "Course"
    }
  ],
  students: [
    {
      type: mongoose.Schema.Types.ObjectId,
      ref: "User"
    }
  ],
  isActive: {
    type: Boolean,
    default: true
  },
  isArchived: {
    type: Boolean,
    default: false
  },
  createdAt: {
    type: Date,
    default: Date.now
  }
});

module.exports = mongoose.model("Batch", BatchSchema);