const mongoose = require("mongoose");

const LectureSchema = new mongoose.Schema({
  title: {
    type: String,
    required: true,
    trim: true
  },
  chapterId:{
    type: mongoose.Schema.Types.ObjectId,
    ref:"Chapter",
    required: true
  },
  topicId:{
    type: mongoose.Schema.Types.ObjectId,
    ref:"Topic",
    required: true
  },
  course: {
    type: mongoose.Schema.Types.ObjectId,
    ref: "Course",
    required: true
  },
  contentType: {
    type: String,
    enum: ["RECORDED", "LIVE", "PDF"],
    required: true
  },
  contentUrl: {
    type: String,
    required: true
  },
  order: {
    type: Number,
    required: true
  },
  isFreePreview: {
    type: Boolean,
    default: false
  },
  isActive: {
    type: Boolean,
    default: true
  },
  createdAt: {
    type: Date,
    default: Date.now
  }
});

module.exports = mongoose.model("Lecture", LectureSchema);
