'use strict';
const { Model } = require('sequelize');
const { defaultKeys, modelDefaults, actionUsers } = require('../sequelize/defaults');
module.exports = (sequelize, DataTypes) => {
  class Settings extends Model {
    static associate(models) {
      actionUsers(Settings, models);
      Settings.belongsTo(models.Branch, {
        targetKey: "branch_id",
        foreignKey: "branch_id",
        as: "branches",
      }); 
    }
  }
  Settings.init({
    ...defaultKeys("setting_id"),
    setting_name: {
      type: DataTypes.STRING,
      allowNull: false,
    },
    setting_desc: {
      type: DataTypes.TEXT('long'),
      allowNull: true,
    },
    setting_type: {
      type: DataTypes.ENUM(["PRIVACY_AND_POLICY", "TERMS_AND_CONDITIONS", "GENDRAL_INFROMATION", "ABOUT_US", "CONTACT_US"]),
      unique: true,
      allowNull: false,
    },
  }, modelDefaults(sequelize, 'settings'));
  return Settings;
};