const { type } = require("@hapi/joi/lib/extend");
const mongoose = require("mongoose");
const aggregatePaginate = require('mongoose-aggregate-paginate-v2');

const SubSubCatagorySchema = new mongoose.Schema(
  {
    wholesellerPrice: {
      type: Number,
      default:0
    },
    stocklimit: {
      type: Number,
      default:0 
    },
    catagoryid: {
      type: String,
    },
    catagory: {
      type: String,
    },
    subcatagory: {
      type: String,
    },
    subcatagoryid: {
      type: String,
    },
    subsubcatagory: {
      type: String,
    },
    imageSubsubCatagory: {
      type: Array,
    },
    variant: {
      type: String,
    },
    variantName: {
      type: String,
    },
    manufacturerName: {
      type: String,
    },
    manufacturer: {
      type: String,
    },
    typeName:{
      type: String,
    },
    type: {
      type: String,
    },
    filter: {
      type: Array,
    },
    color: {
      type: Array,
      default: []
    },
    Show: {
      type: Boolean,
      default:true
    },
    details:{
      type:String,
      default:""
    },
    specifications:{
      type:String,
      default:""
    },
    warranty:{
      type:String,
      default:""
    },
    reviews:{
      type:Array,
      default:[]
    },
    // optional
    combine:{
      type:Boolean,
      default:false
    },
    productPrice: {
      type: Number,
      default: 0,
    },
    SKU: {
      type: String,
    },
    qty: {
      type: Number
    },
    extra: {
      type: Array,
    }
  },
  {
    timestamps: true, // Add this option to enable timestamps
  }
);

SubSubCatagorySchema.plugin(aggregatePaginate);

module.exports = mongoose.model("SubSubCatagorys", SubSubCatagorySchema);


