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

const TournamentMember = sequelize.define('TournamentMember', {
    tournamentId: {
        type: DataTypes.INTEGER,
        autoIncrement: false,
        allowNull: true
    },
    groupId : {
        type: DataTypes.INTEGER,
        autoIncrement: false,
        allowNull: true
    },
    clubMemberId: {
        type: DataTypes.INTEGER,
        autoIncrement: false,
        allowNull: false
    },
    seeded: {
        type: DataTypes.BOOLEAN,
        allowNull: false,
        defaultValue: false
    },
    classId: {
        type: DataTypes.INTEGER,
        allowNull: true
    },
    outOfCompetition: {
        type: DataTypes.BOOLEAN,
        allowNull: false,
        defaultValue: false
    },
    gaveUp: {
        type: DataTypes.BOOLEAN,
        allowNull: false,
        defaultValue: false,
        field: 'gave_up'
    }
  }, {
  underscored: true,
  tableName: 'tournament_member',
  timestamps: true,
});

export default TournamentMember;
