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

page_type: {
        type: DataTypes.ENUM,
      
      

        values: [

"returns_policy",


"privacy_policy",


"terms_of_service",


"contact_us",


"about",


"shipping_policy"

        ],

      },

title: {
        type: DataTypes.TEXT,
      
      

      },

slug: {
        type: DataTypes.TEXT,
      
      

      },

content: {
        type: DataTypes.TEXT,
      
      

      },

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

      },

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

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

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



  return content_pages;
};


