const mongoose = require('mongoose');
const Supplier = require('./Supplier');

const productSchema = new mongoose.Schema(
  {
    productCode: {
      type: String,
      required: true,
      trim: true,
    },
    productName: {
      type: String,
      default: '',
      trim: true,
    },
    category: {
      type: String,
      required: true,
      trim: true
    },

    unitPrice: {
      type: String,
      required: true,
      trim: true
    },
    quantity: {
      type: String,
      required: true,
      trim: true
    },
    expiryDate: {
      type: String
    },
    Supplier: {
      type: mongoose.Schema.Types.ObjectId,
      ref: 'Supplier'
    }

  }
);

module.exports = mongoose.model('Product', productSchema);
