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

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

  return InstitutionContactPerson;
};
