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

due_date: {
        type: DataTypes.DATE,

      },

task_type: {
        type: DataTypes.ENUM,

        values: [

"turnover",

"deep_clean",

"linen",

"inspection"

        ],

      },

status: {
        type: DataTypes.ENUM,

        values: [

"to_do",

"in_progress",

"done"

        ],

      },

notes: {
        type: DataTypes.TEXT,

      },

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

  housekeeping_tasks.associate = (db) => {

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

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

  return housekeeping_tasks;
};

