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 osu_api_credentials = sequelize.define(
    'osu_api_credentials',
    {
      id: {
        type: DataTypes.UUID,
        defaultValue: DataTypes.UUIDV4,
        primaryKey: true,
      },

label: {
        type: DataTypes.TEXT,
      
      

      },

osu_client_numeric: {
        type: DataTypes.INTEGER,
      
      

      },

osu_client_secret: {
        type: DataTypes.TEXT,
      
      

      },

status: {
        type: DataTypes.ENUM,
      
      

        values: [

"active",


"disabled"

        ],

      },

last_token_at: {
        type: DataTypes.DATE,
      
      

      },

last_used_at: {
        type: DataTypes.DATE,
      
      

      },

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

  osu_api_credentials.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.osu_api_credentials.belongsTo(db.users, {
      as: 'createdBy',
    });

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



  return osu_api_credentials;
};


