const mongoose = require('mongoose');

const borrowSchema = new mongoose.Schema({
  borrowDate: {
    type: String,
    required: true,
  },
  dueDate: {
    type: String,
    required: true,
  },
  returnDate: {
    type: String,
  },
  status: {
    type: String,
    enum: ['borrowed', 'returned'],
    default: 'borrowed',
  },
  student_FK: {
    type: mongoose.Schema.Types.ObjectId,
    ref: 'Student',
  },
  book_FK: {
    type: mongoose.Schema.Types.ObjectId,
    ref: 'Book',
  },
});

module.exports = mongoose.model('Borrow', borrowSchema);
