'use strict';
const { Model } = require('sequelize');
const { defaultKeys, modelDefaults, actionUsers } = require('../sequelize/defaults');
module.exports = (sequelize, DataTypes) => {
  class UserRights extends Model {
    static associate(models) {
      actionUsers(UserRights, models);
      UserRights.belongsTo(models.User, {
        targetKey: "user_id",
        foreignKey: "user_id",
        as: "user",
      });
    }
  }

  UserRights.init({
    ...defaultKeys("user_rights_id"),
    user_rights_permission: {
      type: DataTypes.TEXT('long'),
      allowNull: true,
    },
  }, modelDefaults(sequelize, 'user_rights'));
  return UserRights;
};