module.exports = function(sequelize, DataTypes) {
  const presigned_url_requests = sequelize.define(
    'presigned_url_requests',
    {
      id: {
        type: DataTypes.UUID,
        defaultValue: DataTypes.UUIDV4,
        primaryKey: true,
      },

purpose: {
        type: DataTypes.ENUM,
      
      

        values: [

"upload",


"download"

        ],

      },

asset_type: {
        type: DataTypes.ENUM,
      
      

        values: [

"image",


"video",


"audio",


"file"

        ],

      },

requested_key: {
        type: DataTypes.TEXT,
      
      

      },

mime_type: {
        type: DataTypes.TEXT,
      
      

      },

requested_size_mb: {
        type: DataTypes.DECIMAL,
      
      

      },

expires_at: {
        type: DataTypes.DATE,
      
      

      },

status: {
        type: DataTypes.TEXT,
      
      

      },

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

  presigned_url_requests.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.presigned_url_requests.belongsTo(db.projects, {
      as: 'project',
      foreignKey: {
        name: 'projectId',
      },
      constraints: false,
    });

    db.presigned_url_requests.belongsTo(db.users, {
      as: 'user',
      foreignKey: {
        name: 'userId',
      },
      constraints: false,
    });




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

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



  return presigned_url_requests;
};


