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

service_title: {
        type: DataTypes.TEXT,
      
      

      },

service_description: {
        type: DataTypes.TEXT,
      
      

      },

icon_name: {
        type: DataTypes.TEXT,
      
      

      },

is_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,
    },
  );

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

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



  return export_service_items;
};


