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

link_group: {
        type: DataTypes.ENUM,
      
      

        values: [

"quick_links",


"my_account"

        ],

      },

label: {
        type: DataTypes.TEXT,
      
      

      },

href: {
        type: DataTypes.TEXT,
      
      

      },

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

      },

sort_order: {
        type: DataTypes.INTEGER,
      
      

      },

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

  footer_links.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.footer_links.belongsTo(db.footer_settings, {
      as: 'footer',
      foreignKey: {
        name: 'footerId',
      },
      constraints: false,
    });




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

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



  return footer_links;
};


