<?php
declare(strict_types=1);

return [
    // Tournament CRUD
    ['GET',  '/tournaments',                                    'Tournaments\Controllers\TournamentController@index',             ['auth'], 'tournament.view'],
    ['GET',  '/tournaments/create',                             'Tournaments\Controllers\TournamentController@create',            ['auth'], 'tournament.manage'],
    ['POST', '/tournaments',                                    'Tournaments\Controllers\TournamentController@store',             ['auth', 'csrf'], 'tournament.manage'],
    ['GET',  '/tournaments/{id:\d+}',                           'Tournaments\Controllers\TournamentController@show',              ['auth'], 'tournament.view'],
    ['GET',  '/tournaments/{id:\d+}/edit',                      'Tournaments\Controllers\TournamentController@edit',              ['auth'], 'tournament.manage'],
    ['POST', '/tournaments/{id:\d+}',                           'Tournaments\Controllers\TournamentController@update',            ['auth', 'csrf'], 'tournament.manage'],

    // Tournament Actions
    ['POST', '/tournaments/{id:\d+}/open-registration',         'Tournaments\Controllers\TournamentController@openRegistration',  ['auth', 'csrf'], 'tournament.manage'],
    ['POST', '/tournaments/{id:\d+}/close-registration',        'Tournaments\Controllers\TournamentController@closeRegistration', ['auth', 'csrf'], 'tournament.manage'],
    ['POST', '/tournaments/{id:\d+}/generate-bracket',          'Tournaments\Controllers\TournamentController@generateBracket',   ['auth', 'csrf'], 'tournament.manage'],
    ['POST', '/tournaments/{id:\d+}/complete',                  'Tournaments\Controllers\TournamentController@complete',          ['auth', 'csrf'], 'tournament.manage'],

    // Participants
    ['POST', '/tournaments/{tournamentId:\d+}/participants',                              'Tournaments\Controllers\ParticipantController@register',  ['auth', 'csrf'], 'tournament.register_players'],
    ['POST', '/tournaments/{tournamentId:\d+}/participants/{participantId:\d+}/withdraw', 'Tournaments\Controllers\ParticipantController@withdraw',  ['auth', 'csrf'], 'tournament.register_players'],
    ['GET',  '/tournaments/{tournamentId:\d+}/standings',                                 'Tournaments\Controllers\ParticipantController@standings', ['auth'], 'tournament.view'],

    // Matches
    ['GET',  '/tournaments/{tournamentId:\d+}/matches',         'Tournaments\Controllers\MatchController@index',          ['auth'], 'tournament.view'],
    ['GET',  '/matches/{matchId:\d+}/result',                   'Tournaments\Controllers\MatchController@showResultForm', ['auth'], 'tournament.record_results'],
    ['POST', '/matches/{matchId:\d+}/result',                   'Tournaments\Controllers\MatchController@recordResult',   ['auth', 'csrf'], 'tournament.record_results'],
    ['POST', '/matches/{matchId:\d+}/reschedule',               'Tournaments\Controllers\MatchController@reschedule',     ['auth', 'csrf'], 'tournament.manage'],
];
