'use strict';
const { Model } = require('sequelize');

module.exports = (sequelize, DataTypes) => {
  class setting extends Model {
    static associate(models) {
      // No associations needed for settings
    }
  }
  setting.init({
    id: {
      allowNull: false,
      autoIncrement: true,
      primaryKey: true,
      type: DataTypes.INTEGER
    },
    key: {
      type: DataTypes.STRING,
      allowNull: false,
      unique: true
    },
    value: {
      type: DataTypes.TEXT,
      allowNull: true
    },
    label: {
      type: DataTypes.STRING,
      allowNull: true
    },
    description: {
      type: DataTypes.TEXT,
      allowNull: true
    },
    type: {
      type: DataTypes.ENUM('string', 'number', 'boolean', 'json', 'password'),
      defaultValue: 'string'
    },
    group: {
      type: DataTypes.STRING,
      allowNull: true,
      defaultValue: 'general'
    }
  }, {
    sequelize,
    modelName: 'setting',
  });
  return setting;
};
