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

status: {
        type: DataTypes.ENUM,
      
      

        values: [

"selected",


"confirmed",


"cancelled"

        ],

      },

selected_datetime: {
        type: DataTypes.DATE,
      
      

      },

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

  end_of_summer_trip_selections.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.end_of_summer_trip_selections.belongsTo(db.enrollments, {
      as: 'enrollment',
      foreignKey: {
        name: 'enrollmentId',
      },
      constraints: false,
    });

    db.end_of_summer_trip_selections.belongsTo(db.end_of_summer_trip_options, {
      as: 'trip_option',
      foreignKey: {
        name: 'trip_optionId',
      },
      constraints: false,
    });




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

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



  return end_of_summer_trip_selections;
};


