import { DataTypes } from 'sequelize';
import sequelize from '../database.js';

const Club = sequelize.define('Club', {
  name: {
    type: DataTypes.STRING,
    allowNull: false,
    unique: true,
  },
  greetingText: {
    type: DataTypes.TEXT,
    allowNull: true,
    field: 'greeting_text'
  },
  associationMemberNumber: {
    type: DataTypes.STRING,
    allowNull: true,
    field: 'association_member_number'
  },
  myTischtennisFedNickname: {
    type: DataTypes.STRING,
    allowNull: true,
    field: 'my_tischtennis_fed_nickname',
    comment: 'Federation short name for rankings (e.g. HeTTV)'
  },
  autoFetchRankings: {
    type: DataTypes.BOOLEAN,
    allowNull: false,
    defaultValue: false,
    field: 'auto_fetch_rankings',
    comment: 'Enable automatic TTR/QTTR rankings fetch for this club'
  }
}, {
  tableName: 'clubs',
  underscored: true,
  timestamps: true
});

export default Club;
