const mongoose = require("mongoose");
const {mongooseConstantValues} = require('../apps/common/systemConstents')
const Schema = mongoose.Schema

const PriceRuleSchema = mongoose.Schema({
    id: {
      type: Number
    },
    [mongooseConstantValues.TITLE]:{
        type: String,
    },
    [mongooseConstantValues.VALUE_TYPE]: {
      type: String,
      required: true
    },
    [mongooseConstantValues.VALUE]: {
      type: String,
      required: true
    },
    [mongooseConstantValues.CUSTOMER_SELECTION]: {
      type: String,
    },
    [mongooseConstantValues.TARGET_TYPE]: {
        type: String,
    },
    [mongooseConstantValues.TARGET_SELECTION]:{
      type: String,
    },
    [mongooseConstantValues.ALLOCATION_LIMIT]:{
      type: Number,
    },
    [mongooseConstantValues.ONCE_PER_CUSTOMER]:{
      type: Boolean,
    },
    [mongooseConstantValues.USEGE_LIMIT]:{
      type: Number,
    },
    [mongooseConstantValues.STARTS_AT]:{
      type: Date,
    },
    [mongooseConstantValues.ENDS_AT]:{
        type: Date,
    },
    // [mongooseConstantValues.ENTITLED_PRODUCT_IDS]:{
    //   type: Array,
    // },
    // [mongooseConstantValues.ENTITLED_VARIANT_IDS]:{
    //   type: Array,
    // },
    // [mongooseConstantValues.ENTITLED_COLLECTION_IDS]:{
    //   type: Array,
    // },
    // [mongooseConstantValues.ENTITLED_COUNTRY_IDS]:{
    //   type: Array,
    // },
    // [mongooseConstantValues.PREREQUISITE_PRODUCT_IDS]:{
    //   type: Array,
    // },
    // [mongooseConstantValues.PREREQUISITE_VARIANT_IDS]:{
    //   type: Array,
    // },

    // [mongooseConstantValues.PREREQUISITE_COLLECTION_IDS]:{
    //   type: Array,
    // },
    // [mongooseConstantValues.PREREQUISITE_SAVED_SEARCH_IDS]:{
    //   type: Array,
    // },
    // [mongooseConstantValues.PREREQUISITE_CUSTOMER_IDS]:{
    //   type: Array,
    // },
    [mongooseConstantValues.PREREQUISITE_SUBTOTAL_RANGE]:{
      type: Number,
    },
    [mongooseConstantValues.PREREQUISITE_QUANTITY_RANGE]:{
      type: Number,
    },
    [mongooseConstantValues.PREREQUISITE_SHIPPING_PRICE_RANGE]:{
      type: Number,
    },
    [mongooseConstantValues.CREATED_ON]:{
        type: Date,
        required: true
    },
    [mongooseConstantValues.UPDATED_ON]:{
      type: Date,
      required: true
    }
  });
  
  module.exports = mongoose.model("PriceRule", PriceRuleSchema);