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

entity_type: {
        type: DataTypes.ENUM,
      
      

        values: [

"product",


"category",


"collection",


"cms_page"

        ],

      },

entity_key: {
        type: DataTypes.TEXT,
      
      

      },

meta_title_ar: {
        type: DataTypes.TEXT,
      
      

      },

meta_title_en: {
        type: DataTypes.TEXT,
      
      

      },

meta_description_ar: {
        type: DataTypes.TEXT,
      
      

      },

meta_description_en: {
        type: DataTypes.TEXT,
      
      

      },

canonical_url: {
        type: DataTypes.TEXT,
      
      

      },

open_graph_image_url: {
        type: DataTypes.TEXT,
      
      

      },

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

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

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



  return seo_entries;
};


