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

status: {
        type: DataTypes.TEXT,

      },

asset_id: {
        type: DataTypes.TEXT,

      },

description: {
        type: DataTypes.TEXT,

      },

brand: {
        type: DataTypes.TEXT,

      },

product: {
        type: DataTypes.TEXT,

      },

asset_type: {
        type: DataTypes.TEXT,

      },

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

  client_dam.associate = (db) => {

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

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

  return client_dam;
};

