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

name: {
        type: DataTypes.TEXT,
      
      

      },

preset_type: {
        type: DataTypes.ENUM,
      
      

        values: [

"pitch_correction",


"harmony_generation",


"layering",


"noise_reduction",


"de_essing",


"eq",


"full_chain"

        ],

      },

description: {
        type: DataTypes.TEXT,
      
      

      },

intensity: {
        type: DataTypes.DECIMAL,
      
      

      },

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

      },

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

  vocal_processing_presets.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.vocal_processing_presets.belongsTo(db.genres, {
      as: 'recommended_genre',
      foreignKey: {
        name: 'recommended_genreId',
      },
      constraints: false,
    });

    db.vocal_processing_presets.belongsTo(db.organizations, {
      as: 'organizations',
      foreignKey: {
        name: 'organizationsId',
      },
      constraints: false,
    });




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

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



  return vocal_processing_presets;
};


