const mongoose = require('mongoose');

const expenseSchema = new mongoose.Schema({
  expenseTitle: {
    type: String,
    required: true
  },
  expenseCategory: {
    type: String,
    required: true,
    enum: [
      'Salary', 'Electricity Bill', 'Water Bill', 'Internet Bill',
      'Rent', 'Maintenance', 'Stationery', 'Equipment', 'Transportation',
      'Food', 'Events', 'Sports', 'Library', 'Medical', 'Other'
    ]
  },
  amount: {
    type: Number,
    required: true
  },
  expenseDate: {
    type: Date,
    required: true,
    default: Date.now
  },
  paymentMethod: {
    type: String,
    enum: ['Cash', 'Card', 'Bank Transfer', 'Mobile Banking'],
    required: true
  },
  description: {
    type: String
  },
  vendorName: {
    type: String
  },
  remarks: {
    type: String
  },
  createdBy: {
    type: mongoose.Schema.Types.ObjectId,
    ref: 'Admin'
  }
}, {
  timestamps: true
});

module.exports = mongoose.model('Expense', expenseSchema);