const { DataTypes } = require('sequelize');

module.exports = (sequelize) => {
  const EventContactPerson = sequelize.define('EventContactPerson', {
    event_id: {
      type: DataTypes.INTEGER,
      references: {
        model: 'Event',
        key: 'id'
      },
      onUpdate: 'CASCADE',
      onDelete: 'CASCADE'
    },
    contact_person_id: {
      type: DataTypes.INTEGER,
      references: {
        model: 'ContactPerson',
        key: 'id'
      },
      onUpdate: 'CASCADE',
      onDelete: 'CASCADE'
    }
  }, {
    tableName: 'EventContactPersons',
    timestamps: false
  });

  return EventContactPerson;
};
