const mongoose = require('mongoose');
const Schema = mongoose.Schema;

const SettingsSchema = new Schema({
  companyId: {
    type: Schema.Types.ObjectId,
    ref: 'Company', // Reference to the Company model
    required: true
  },
  branchId: {
    type: Schema.Types.ObjectId,
    ref: 'Branch', // Reference to the Branch model
    required: true
  },
  startUpStockValue:{
type:Number,default:0
  },
  defaultSmsUserId:{
    type: Schema.Types.ObjectId,
    ref: 'User', // Reference to the Company model
    required: false
  },
  defaultTimeOut: {
    type: Number,
    default: 30 // Default timeout in minutes
  
},
  defaultStartDate: {
    type: Date,  // Default start date for records or transactions
    default: Date.now, // Automatically sets to the current date if not provided
  },
  kitchenPrinterIP: {
    type: String,
    default: '192.168.20.100'
  },
  kitchenPrinterBridgeProtocol: {
    type: String,
    enum: ['http', 'https'],
    default: 'http'
  },
  kitchenPrinterBridgeIP: {
    type: String,
    default: 'localhost'
  },
  kitchenPrinterBridgePort: {
    type: String,
    default: '3000'
  },
  companyName: {
    type: String,
    default: 'Zad'
  },
  companyLogo: {
    type: String,
    default: '/uploads/cyber.jpeg'
  }
}, {
  timestamps: true // Adds createdAt and updatedAt fields automatically
});

module.exports = mongoose.model('Settings', SettingsSchema);
