const mongoose = require("mongoose")

const CourseSchema = new mongoose.Schema({
  name: {
    type: String,
    required: true
  },
  slug: {
    type: String,
    required: true,
    lowercase: true
  },
  subject: {
    type: mongoose.Schema.Types.ObjectId,
    ref: "Subject",
    required: true
  },
  class: {
    type: String,
    enum: ["Class 9", "Class 10", "Class 11", "Class 12"],
    required: true
  },
  goal: {
  type: String,
  enum: ['CBSE', 'NEET', 'JEE', 'Nursing', 'CUET'],
  default: 'CBSE'
  },
  description: {
    type: String,
    default: ""
  },
  thumbnail:{
    type: String,
    default: ""
  },
  price: {
    type: Number,
    default: 0
  },
  isPaid: {
    type: Boolean,
    default: false
  },
  isActive: {
    type: Boolean,
    default: true
  },
  isArchived:{
    type: Boolean,
    default: false
  },
  isFrozen:{
    type: Boolean,
    default: false
  },
  isContentLocked: {
    type: Boolean,
    default: false
  },
  batches:[
    {
      type: mongoose.Schema.Types.ObjectId,
      ref: "Batch"
    }
  ],
  createdAt: {
    type: Date,
    default: Date.now
  }
})

module.exports = mongoose.model("Course", CourseSchema)
