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

const OfficialCompetition = sequelize.define('OfficialCompetition', {
  id: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true },
  tournamentId: { type: DataTypes.INTEGER, allowNull: false },
  // Englische Attributnamen, gemappt auf bestehende DB-Spalten
  ageClassCompetition: { type: DataTypes.STRING, allowNull: true, field: 'age_class_competition' },
  performanceClass: { type: DataTypes.STRING, allowNull: true, field: 'performance_class' },
  startTime: { type: DataTypes.STRING, allowNull: true, field: 'start_time' },
  registrationDeadlineDate: { type: DataTypes.STRING, allowNull: true, field: 'registration_deadline_date' },
  registrationDeadlineOnline: { type: DataTypes.STRING, allowNull: true, field: 'registration_deadline_online' },
  cutoffDate: { type: DataTypes.STRING, allowNull: true, field: 'cutoff_date' },
  ttrRelevant: { type: DataTypes.STRING, allowNull: true },
  openTo: { type: DataTypes.STRING, allowNull: true, field: 'open_to' },
  preliminaryRound: { type: DataTypes.STRING, allowNull: true, field: 'preliminary_round' },
  finalRound: { type: DataTypes.STRING, allowNull: true, field: 'final_round' },
  maxParticipants: { type: DataTypes.STRING, allowNull: true, field: 'max_participants' },
  entryFee: { type: DataTypes.STRING, allowNull: true, field: 'entry_fee' },
}, {
  tableName: 'official_competitions',
  timestamps: true,
  underscored: true,
});

export default OfficialCompetition;


