const config = require('../../config');
const providers = config.providers;
const crypto = require('crypto');
const bcrypt = require('bcrypt');
const moment = require('moment');

module.exports = function(sequelize, DataTypes) {
  const platform_config = sequelize.define(
    'platform_config',
    {
      id: {
        type: DataTypes.UUID,
        defaultValue: DataTypes.UUIDV4,
        primaryKey: true,
      },

platform_fee_percent: {
        type: DataTypes.DECIMAL,
      
      

      },

auto_release_days: {
        type: DataTypes.INTEGER,
      
      

      },

max_revision_count: {
        type: DataTypes.INTEGER,
      
      

      },

min_review_length: {
        type: DataTypes.INTEGER,
      
      

      },

new_user_verify_email: {
        type: DataTypes.BOOLEAN,
      
        allowNull: false,
        defaultValue: false,
      
      

      },

tutor_two_factor_required: {
        type: DataTypes.BOOLEAN,
      
        allowNull: false,
        defaultValue: false,
      
      

      },

maintenance_mode: {
        type: DataTypes.BOOLEAN,
      
        allowNull: false,
        defaultValue: false,
      
      

      },

maintenance_message: {
        type: DataTypes.TEXT,
      
      

      },

announcement_banner_enabled: {
        type: DataTypes.BOOLEAN,
      
        allowNull: false,
        defaultValue: false,
      
      

      },

announcement_banner_text: {
        type: DataTypes.TEXT,
      
      

      },

jitsi_sdk_key: {
        type: DataTypes.TEXT,
      
      

      },

jitsi_sdk_secret: {
        type: DataTypes.TEXT,
      
      

      },

      importHash: {
        type: DataTypes.STRING(255),
        allowNull: true,
        unique: true,
      },
    },
    {
      timestamps: true,
      paranoid: true,
      freezeTableName: true,
    },
  );

  platform_config.associate = (db) => {


/// loop through entities and it's fields, and if ref === current e[name] and create relation has many on parent entity












































//end loop






    db.platform_config.belongsTo(db.users, {
      as: 'createdBy',
    });

    db.platform_config.belongsTo(db.users, {
      as: 'updatedBy',
    });
  };



  return platform_config;
};


