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

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

  return ContactPersonPosition;
};
