# The Tournament Model

Since ProtoBuf is used, the Tournament Model can also be found within the proto models. You can find it in `node_modules/moons-ta-client/dist/models/models.d.ts`. The standard Tournament Model is: 
```ts
export interface Tournament {
    /**
     * @generated from protobuf field: string guid = 1;
     */
    guid: string;
    /**
     * @generated from protobuf field: proto.models.Tournament.TournamentSettings settings = 2;
     */
    settings?: Tournament_TournamentSettings;
    /**
     * @generated from protobuf field: repeated proto.models.User users = 3;
     */
    users: User[];
    /**
     * @generated from protobuf field: repeated proto.models.Match matches = 4;
     */
    matches: Match[];
    /**
     * @generated from protobuf field: repeated proto.models.QualifierEvent qualifiers = 5;
     */
    qualifiers: QualifierEvent[];
    /**
     * @generated from protobuf field: proto.models.CoreServer server = 6;
     */
    server?: CoreServer;
}
```
Let me also provide the interfaces for settings, users, and the other fields.
```ts
export interface Tournament_TournamentSettings {
    tournamentName: string;
    tournamentImage: Uint8Array;
    enableTeams: boolean;
    enablePools: boolean;
    teams: Tournament_TournamentSettings_Team[];
    scoreUpdateFrequency: number;
    bannedMods: string[];
    pools: Tournament_TournamentSettings_Pool[];
    showTournamentButton: boolean;
    showQualifierButton: boolean;
    allowUnauthorizedView: boolean;
}


export interface Tournament_TournamentSettings_Pool {
    guid: string;
    name: string;
    image: Uint8Array;
    maps: Map[];
}


export interface Tournament_TournamentSettings_Team {
    guid: string;
    name: string;
    image: Uint8Array;
}

export interface User {
    guid: string;
    name: string;
    platformId: string;
    clientType: User_ClientTypes;
    teamId: string;
    playState: User_PlayStates;
    downloadState: User_DownloadStates;
    modList: string[];
    streamScreenCoordinates?: User_Point;
    streamDelayMs: bigint;
    streamSyncStartMs: bigint;
    discordInfo?: User_DiscordInfo;
    userImage: Uint8Array;
    permissions: Permissions;
}


export interface User_DiscordInfo {
    userId: string;
    username: string;
    avatarUrl: string;
}


export interface User_Point {
    x: number;
    y: number;
}


export declare enum User_PlayStates {
    InMenu = 0,
    WaitingForCoordinator = 1,
    InGame = 2
}


export declare enum User_DownloadStates {
    None = 0,
    Downloading = 1,
    Downloaded = 2,
    DownloadError = 3
}


export declare enum User_ClientTypes {
    Player = 0,
    WebsocketConnection = 1
}


export interface Match {
    guid: string;
    associatedUsers: string[];
    leader: string;
    selectedMap?: Map;
}


export interface QualifierEvent {
    guid: string;
    name: string;
    image: Uint8Array;
    infoChannel?: Channel;
    qualifierMaps: Map[];
    flags: QualifierEvent_EventSettings;
    sort: QualifierEvent_LeaderboardSort;
}


export declare enum QualifierEvent_EventSettings {
    None = 0,
    HideScoresFromPlayers = 1,
    DisableScoresaberSubmission = 2,
    EnableDiscordScoreFeed = 4,
    EnableDiscordLeaderboard = 8
}


export declare enum QualifierEvent_LeaderboardSort {
    ModifiedScore = 0,
    ModifiedScoreAscending = 1,
    ModifiedScoreTarget = 2,
    NotesMissed = 3,
    NotesMissedAscending = 4,
    NotesMissedTarget = 5,
    BadCuts = 6,
    BadCutsAscending = 7,
    BadCutsTarget = 8,
    MaxCombo = 9,
    MaxComboAscending = 10,
    MaxComboTarget = 11,
    GoodCuts = 12,
    GoodCutsAscending = 13,
    GoodCutsTarget = 14
}


export interface CoreServer {
    name: string;
    address: string;
    port: number;
    websocketPort: number;
}
```
Note that you will most probably never use these or refer to this, as these are in the types when you fetch a tournament and are in your intellisense most probably. 

For now this is where I will leave the tournament model. Just be aware of what a tournament looks like and what options you have. More options exist and may come in the future, however they are meant to be read only by the server, hence they are not passed on to the client.