const mongoose = require("mongoose");

const prefixSchema = new mongoose.Schema(
  {
    moduleName: {
      type: String,
      required: true,
      trim: true,
    },

    prefixCode: {
      type: String,
      required: true,
      uppercase: true,
      unique: true,
      trim: true,
    },
    // separator : {
    //     type :String,   
    // },

    description: {
      type: String,
      trim: true,
    },

    // sequenceStart: {
    //   type: Number,
    //   default: 1,
    // },

    // currentSequence: {
    //   type: Number,
    //   default: 1,
    // },

    // paddingLength : {
    //     type : Number
    // },

    isActive: {
      type: Boolean,
      default: true,
    },

    // SOFT DELETE
    isDeleted: {
      type: Boolean,
      default: false,
    },

    deletedAt: Date,
    deletedBy: {
      type: mongoose.Schema.Types.ObjectId,
      ref: "User",
    },

    // AUDIT FIELDS
    createdBy: {
      type: mongoose.Schema.Types.ObjectId,
      ref: "User",
    },

    updatedBy: {
      type: mongoose.Schema.Types.ObjectId,
      ref: "User",
    },
  },
  { timestamps: true }
);

module.exports = mongoose.model("Prefix", prefixSchema);