// dependencies and modules

const mongoose = require('mongoose');

const courseSchwema = new mongoose.Schema({
	name:{
		type:String,
		required: [true,"Course is required"]
	}, 

	description: {
		type:String,
		required:[true, "Description is required"]
	},

	price:{
		type:number
		required:[true, "Price is required"]
	},

	isActive:{
		type: Boolean,
	default: true
	},

	createdOn:{
		type:Date,
	default: new Date()
	},

	enrollees:[{

		userID:{
			type:String
			required:[true, "User Id is required"]
		 },
		 enrolledOn:{
		 	type: Date,
		 default: new Date
		 }
	
		}
	]

});

// Model Exports
module.exports = mongoose.model('Course', courseSchema);