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

date: {
        type: DataTypes.DATE,

      },

alloted_beds: {
        type: DataTypes.INTEGER,

      },

closed_for_arrival: {
        type: DataTypes.BOOLEAN,

        allowNull: false,
        defaultValue: false,

      },

closed_for_departure: {
        type: DataTypes.BOOLEAN,

        allowNull: false,
        defaultValue: false,

      },

override_price: {
        type: DataTypes.DECIMAL,

      },

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

  inventory_dates.associate = (db) => {

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

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

  return inventory_dates;
};

