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

module.exports = (sequelize) => {
  const WorshipLeader = sequelize.define('WorshipLeader', {
    code: {
      type: DataTypes.STRING(32),
      allowNull: false,
      unique: true,
    },
    name: {
      type: DataTypes.STRING(255),
      allowNull: false,
    },
    aliases: {
      // Comma-separated list of alternative codes (kept simple to avoid join tables).
      type: DataTypes.STRING(512),
      allowNull: true,
      defaultValue: '',
    },
    active: {
      type: DataTypes.BOOLEAN,
      allowNull: false,
      defaultValue: true,
    },
  }, {
    tableName: 'worship_leaders',
    timestamps: true,
  });

  return WorshipLeader;
};

