<?php
declare(strict_types=1);

return [
    // Dashboard
    ['GET',  '/facility-grids/dashboard',      'FacilityGrids\Controllers\GridDashboardController@index',   ['auth'], 'facility_grid.view'],

    // Grid CRUD
    ['GET',  '/facility-grids',                'FacilityGrids\Controllers\FacilityGridController@index',    ['auth'], 'facility_grid.view'],
    ['GET',  '/facility-grids/create',         'FacilityGrids\Controllers\FacilityGridController@create',   ['auth'], 'facility_grid.manage'],
    ['POST', '/facility-grids',                'FacilityGrids\Controllers\FacilityGridController@store',    ['auth', 'csrf'], 'facility_grid.manage'],
    ['GET',  '/facility-grids/{id:\d+}',       'FacilityGrids\Controllers\FacilityGridController@show',     ['auth'], 'facility_grid.view'],
    ['GET',  '/facility-grids/{id:\d+}/edit',  'FacilityGrids\Controllers\FacilityGridController@edit',     ['auth'], 'facility_grid.manage'],
    ['POST', '/facility-grids/{id:\d+}/update','FacilityGrids\Controllers\FacilityGridController@update',   ['auth', 'csrf'], 'facility_grid.manage'],
    ['POST', '/facility-grids/{id:\d+}/toggle','FacilityGrids\Controllers\FacilityGridController@toggle',   ['auth', 'csrf'], 'facility_grid.manage'],

    // API — grid state (for AJAX polling)
    ['GET',  '/api/facility-grids/{id:\d+}/state', 'FacilityGrids\Controllers\FacilityGridController@apiState', ['auth'], 'facility_grid.view'],

    // Zone Schedules
    ['GET',  '/facility-grids/{gridId:\d+}/schedules',                       'FacilityGrids\Controllers\ZoneScheduleController@index',          ['auth'], 'facility_grid.manage'],
    ['POST', '/facility-grids/{gridId:\d+}/schedules',                       'FacilityGrids\Controllers\ZoneScheduleController@store',          ['auth', 'csrf'], 'facility_grid.manage'],
    ['POST', '/facility-grids/{gridId:\d+}/schedules/{scheduleId:\d+}',      'FacilityGrids\Controllers\ZoneScheduleController@update',         ['auth', 'csrf'], 'facility_grid.manage'],
    ['POST', '/facility-grids/{gridId:\d+}/schedules/{scheduleId:\d+}/delete','FacilityGrids\Controllers\ZoneScheduleController@destroy',       ['auth', 'csrf'], 'facility_grid.manage'],
    ['GET',  '/facility-grids/{gridId:\d+}/schedules/conflicts',             'FacilityGrids\Controllers\ZoneScheduleController@checkConflicts', ['auth'], 'facility_grid.view'],

    // Zone Trainees
    ['POST', '/facility-grids/{gridId:\d+}/trainees',                        'FacilityGrids\Controllers\ZoneTraineeController@assign',          ['auth', 'csrf'], 'facility_grid.manage'],
    ['POST', '/facility-grids/{gridId:\d+}/trainees/{traineeId:\d+}/remove', 'FacilityGrids\Controllers\ZoneTraineeController@remove',          ['auth', 'csrf'], 'facility_grid.manage'],
    ['POST', '/facility-grids/{gridId:\d+}/trainees/{traineeId:\d+}/move',   'FacilityGrids\Controllers\ZoneTraineeController@move',            ['auth', 'csrf'], 'facility_grid.manage'],
    ['POST', '/facility-grids/{gridId:\d+}/zones/{zoneId:\d+}/clear',        'FacilityGrids\Controllers\ZoneTraineeController@clearZone',       ['auth', 'csrf'], 'facility_grid.manage'],

    // Monthly Plans
    ['GET',  '/facility-grids/{gridId:\d+}/plans',                          'FacilityGrids\Controllers\MonthlyPlanController@index',    ['auth'], 'facility_grid.view'],
    ['GET',  '/facility-grids/{gridId:\d+}/plans/create',                   'FacilityGrids\Controllers\MonthlyPlanController@create',   ['auth'], 'facility_grid.manage'],
    ['POST', '/facility-grids/{gridId:\d+}/plans',                          'FacilityGrids\Controllers\MonthlyPlanController@store',    ['auth', 'csrf'], 'facility_grid.manage'],
    ['GET',  '/facility-grids/{gridId:\d+}/plans/{planId:\d+}',             'FacilityGrids\Controllers\MonthlyPlanController@show',     ['auth'], 'facility_grid.view'],
    ['POST', '/facility-grids/{gridId:\d+}/plans/{planId:\d+}/activate',    'FacilityGrids\Controllers\MonthlyPlanController@activate', ['auth', 'csrf'], 'facility_grid.manage'],
    ['POST', '/facility-grids/{gridId:\d+}/plans/{planId:\d+}/archive',     'FacilityGrids\Controllers\MonthlyPlanController@archive',  ['auth', 'csrf'], 'facility_grid.manage'],
    ['GET',  '/facility-grids/{gridId:\d+}/plans/{planId:\d+}/diff',        'FacilityGrids\Controllers\MonthlyPlanController@diff',     ['auth'], 'facility_grid.view'],

    // Pool Hour Plans
    ['GET',  '/facility-grids/{gridId:\d+}/plans/{planId:\d+}/hours',                               'FacilityGrids\Controllers\PoolHourPlanController@index',     ['auth'], 'facility_grid.view'],
    ['GET',  '/facility-grids/{gridId:\d+}/plans/{planId:\d+}/hours/{date}',                        'FacilityGrids\Controllers\PoolHourPlanController@dayView',   ['auth'], 'facility_grid.view'],
    ['GET',  '/facility-grids/{gridId:\d+}/plans/{planId:\d+}/hours/{date}/{hour}',                 'FacilityGrids\Controllers\PoolHourPlanController@showHour',  ['auth'], 'facility_grid.view'],
    ['POST', '/facility-grids/{gridId:\d+}/plans/{planId:\d+}/hours/{date}/{hour}',                 'FacilityGrids\Controllers\PoolHourPlanController@storeHour', ['auth', 'csrf'], 'facility_grid.manage'],
    ['POST', '/facility-grids/{gridId:\d+}/plans/{planId:\d+}/hours/{date}/{hour}/copy',            'FacilityGrids\Controllers\PoolHourPlanController@copyHour',  ['auth', 'csrf'], 'facility_grid.manage'],

    // Facility Attendance
    ['GET',  '/facility-grids/{gridId:\d+}/attendance',         'FacilityGrids\Controllers\FacilityAttendanceController@index',  ['auth'], 'facility_grid.manage'],
    ['POST', '/facility-grids/{gridId:\d+}/attendance',         'FacilityGrids\Controllers\FacilityAttendanceController@store',  ['auth', 'csrf'], 'facility_grid.manage'],
    ['GET',  '/facility-grids/{gridId:\d+}/attendance/report',  'FacilityGrids\Controllers\FacilityAttendanceController@report', ['auth'], 'facility_grid.view'],
    ['POST', '/facility-grids/{gridId:\d+}/attendance/remind',  'FacilityGrids\Controllers\FacilityAttendanceController@remind', ['auth', 'csrf'], 'facility_grid.manage'],

    // Pool Financial Dashboard
    ['GET',  '/facility-grids/{gridId:\d+}/financial-dashboard',        'FacilityGrids\Controllers\PoolFinancialDashboardController@dashboard', ['auth'], 'facility_grid.view'],
    ['GET',  '/facility-grids/{gridId:\d+}/financial-dashboard/export', 'FacilityGrids\Controllers\PoolFinancialDashboardController@export',    ['auth'], 'facility_grid.view'],

    // Legacy redirects (mirror + pool → unified facility-grids)
    ['GET', '/mirror',                  'FacilityGrids\Controllers\RedirectController@mirrorIndex',    ['auth'], 'facility_grid.view'],
    ['GET', '/mirror/{id:\d+}',         'FacilityGrids\Controllers\RedirectController@mirrorShow',     ['auth'], 'facility_grid.view'],
    ['GET', '/pool/{id:\d+}/grid',      'FacilityGrids\Controllers\RedirectController@poolGrid',       ['auth'], 'facility_grid.view'],
    ['GET', '/pool/{id:\d+}/schedules', 'FacilityGrids\Controllers\RedirectController@poolSchedules',  ['auth'], 'facility_grid.view'],
];
