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

name: {
        type: DataTypes.TEXT,

      },

description: {
        type: DataTypes.TEXT,

      },

capacity: {
        type: DataTypes.INTEGER,

      },

gender_policy: {
        type: DataTypes.ENUM,

        values: [

"mixed",

"female",

"male"

        ],

      },

amenities_json: {
        type: DataTypes.TEXT,

      },

base_price: {
        type: DataTypes.DECIMAL,

      },

is_private: {
        type: DataTypes.BOOLEAN,

        allowNull: false,
        defaultValue: false,

      },

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

  room_types.associate = (db) => {

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

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

  return room_types;
};

