const mongoose = require('mongoose');

const customerSchema = new mongoose.Schema({
  name: {
    type: String,
    required: true,
    trim: true
  },
  rest_name: {
    type: String,
    required: true,
    trim: true
  },
  seat_capacity: {
    type: Number,
    required: true
  },
  off_percentage: {
    type: Number,
    default: 0
  },
  email: {
    type: String,
    required: true,
    trim: true,
    lowercase: true
  },
  phone: {
    type: String,
    required: true
  },
  fullLicenseKey: {
    type: String,
    required: true,
    unique: true
  },
  price: {
    type: Number,
    required: true
  },
  renewal: {
    type: Number,
    required: true
  },
  dateOfPurchase: {
    type: Date,
    required: true
  },
  dateOfRenewal: {
    type: Date,
    required: true
  },
  template: {
    type: String,
    default: 'defaultTemplate'
  },
  image: {
    type: String
  }
}, { timestamps: { createdAt: 'created_at', updatedAt: 'updated_at' } });

module.exports = mongoose.model('Customer', customerSchema);
