<?php
/**
 * Definicje routingu aplikacji
 */

return [
    // Auth routes
    'login' => ['controller' => 'AuthController', 'action' => 'login', 'auth' => false],
    'logout' => ['controller' => 'AuthController', 'action' => 'logout', 'auth' => true],
    'change-password' => ['controller' => 'AuthController', 'action' => 'changePassword', 'auth' => true],
    
    // Dashboard
    '' => ['controller' => 'DashboardController', 'action' => 'index', 'auth' => true],
    'dashboard' => ['controller' => 'DashboardController', 'action' => 'index', 'auth' => true],
    
    // Users (admin and reseller) - kontrola w kontrolerze
    'users' => ['controller' => 'UserController', 'action' => 'index', 'auth' => true],
    'users/add' => ['controller' => 'UserController', 'action' => 'add', 'auth' => true],
    'users/edit' => ['controller' => 'UserController', 'action' => 'edit', 'auth' => true],
    'users/delete' => ['controller' => 'UserController', 'action' => 'delete', 'auth' => true],
    'users/reset-password' => ['controller' => 'UserController', 'action' => 'resetPassword', 'auth' => true],
    
    // Devices
    'devices' => ['controller' => 'DeviceController', 'action' => 'index', 'auth' => true],
    'devices/add' => ['controller' => 'DeviceController', 'action' => 'add', 'auth' => true],
    'devices/edit' => ['controller' => 'DeviceController', 'action' => 'edit', 'auth' => true],
    'devices/delete' => ['controller' => 'DeviceController', 'action' => 'delete', 'auth' => true],
    'devices/clone' => ['controller' => 'DeviceController', 'action' => 'clone', 'auth' => true],
    'devices/toggle-block' => ['controller' => 'DeviceController', 'action' => 'toggleBlock', 'auth' => true],
    
    // Playlists
    'playlists' => ['controller' => 'PlaylistController', 'action' => 'index', 'auth' => true],
    'playlists/add' => ['controller' => 'PlaylistController', 'action' => 'add', 'auth' => true],
    'playlists/edit' => ['controller' => 'PlaylistController', 'action' => 'edit', 'auth' => true],
    'playlists/delete' => ['controller' => 'PlaylistController', 'action' => 'delete', 'auth' => true],
    'playlists/clone' => ['controller' => 'PlaylistController', 'action' => 'clone', 'auth' => true],
    'playlists/bulk' => ['controller' => 'PlaylistController', 'action' => 'bulk', 'auth' => true],
    'playlists/toggle-active' => ['controller' => 'PlaylistController', 'action' => 'toggleActive', 'auth' => true],
    
    // DNS (zmiana adresów)
    'dns' => ['controller' => 'DnsController', 'action' => 'index', 'auth' => true],
    'dns/replace' => ['controller' => 'DnsController', 'action' => 'replace', 'auth' => true],
    
    // Notatki
    'notes' => ['controller' => 'NotesController', 'action' => 'index', 'auth' => true],
    'notes/save' => ['controller' => 'NotesController', 'action' => 'save', 'auth' => true],
    
    // Xtream Check
    'xtream-check' => ['controller' => 'XtreamCheckController', 'action' => 'index', 'auth' => true],
    'xtream-check/check' => ['controller' => 'XtreamCheckController', 'action' => 'check', 'auth' => true],
    'xtream-check/streams' => ['controller' => 'XtreamCheckController', 'action' => 'getStreams', 'auth' => true],
    'xtream-check/generate' => ['controller' => 'XtreamCheckController', 'action' => 'generateM3u', 'auth' => true],
    
    // Logs (admin only)
    'admin/logs' => ['controller' => 'LogController', 'action' => 'index', 'auth' => true, 'admin' => true],
    'admin/logs/api' => ['controller' => 'LogController', 'action' => 'api', 'auth' => true, 'admin' => true],
    'admin/logs/clear' => ['controller' => 'LogController', 'action' => 'clear', 'auth' => true, 'admin' => true],
    
    // Aktywne sesje (admin and reseller) - kontrola w kontrolerze
    'admin/sessions' => ['controller' => 'SessionController', 'action' => 'index', 'auth' => true],
    'admin/sessions/terminate' => ['controller' => 'SessionController', 'action' => 'terminate', 'auth' => true],
    
    // Administracja (admin only)
    'admin/settings' => ['controller' => 'AdminController', 'action' => 'settings', 'auth' => true, 'admin' => true],
    'admin/monitor' => ['controller' => 'AdminController', 'action' => 'monitor', 'auth' => true, 'admin' => true],
    'admin/monitor/api' => ['controller' => 'AdminController', 'action' => 'monitorApi', 'auth' => true, 'admin' => true],
    'admin/system-logs' => ['controller' => 'AdminController', 'action' => 'systemLogs', 'auth' => true, 'admin' => true],
    'admin/cron' => ['controller' => 'AdminController', 'action' => 'cron', 'auth' => true, 'admin' => true],
    'admin/cron/save' => ['controller' => 'AdminController', 'action' => 'cronSave', 'auth' => true, 'admin' => true],
    'admin/cron/delete' => ['controller' => 'AdminController', 'action' => 'cronDelete', 'auth' => true, 'admin' => true],
    'admin/cron/run' => ['controller' => 'AdminController', 'action' => 'cronRun', 'auth' => true, 'admin' => true],
    'admin/maintenance/toggle' => ['controller' => 'AdminController', 'action' => 'toggleMaintenance', 'auth' => true, 'admin' => true],
    'admin/tools' => ['controller' => 'AdminController', 'action' => 'tools', 'auth' => true, 'admin' => true],
    'admin/tools/optimize' => ['controller' => 'AdminController', 'action' => 'optimizeDb', 'auth' => true, 'admin' => true],
    'admin/tools/backup' => ['controller' => 'AdminController', 'action' => 'createBackup', 'auth' => true, 'admin' => true],
    'admin/tools/clear-cache' => ['controller' => 'AdminController', 'action' => 'clearCache', 'auth' => true, 'admin' => true],
    'admin/tools/clear-sessions' => ['controller' => 'AdminController', 'action' => 'clearSessions', 'auth' => true, 'admin' => true],
    'admin/tools/test-email' => ['controller' => 'AdminController', 'action' => 'testEmail', 'auth' => true, 'admin' => true],
    'admin/backups' => ['controller' => 'AdminController', 'action' => 'backups', 'auth' => true, 'admin' => true],
    'admin/backups/download' => ['controller' => 'AdminController', 'action' => 'downloadBackup', 'auth' => true, 'admin' => true],
    'admin/backups/delete' => ['controller' => 'AdminController', 'action' => 'deleteBackup', 'auth' => true, 'admin' => true],
    'admin/updates' => ['controller' => 'AdminController', 'action' => 'updates', 'auth' => true, 'admin' => true],
    'admin/phpinfo' => ['controller' => 'AdminController', 'action' => 'phpinfo', 'auth' => true, 'admin' => true],
    'admin/phpinfo-raw' => ['controller' => 'AdminController', 'action' => 'phpinfoRaw', 'auth' => true, 'admin' => true],
    
    // Linki zewnętrzne (admin only)
    'admin/links' => ['controller' => 'LinksController', 'action' => 'index', 'auth' => true, 'admin' => true],
    'admin/links/add' => ['controller' => 'LinksController', 'action' => 'add', 'auth' => true, 'admin' => true],
    'admin/links/edit' => ['controller' => 'LinksController', 'action' => 'edit', 'auth' => true, 'admin' => true],
    'admin/links/delete' => ['controller' => 'LinksController', 'action' => 'delete', 'auth' => true, 'admin' => true],
    'admin/links/toggle-active' => ['controller' => 'LinksController', 'action' => 'toggleActive', 'auth' => true, 'admin' => true],
    'admin/links/update-order' => ['controller' => 'LinksController', 'action' => 'updateOrder', 'auth' => true, 'admin' => true],
    
    // Raporty (admin only)
    'reports/activity' => ['controller' => 'ReportController', 'action' => 'activity', 'auth' => true, 'admin' => true],
    'reports/api' => ['controller' => 'ReportController', 'action' => 'api', 'auth' => true, 'admin' => true],
    'reports/audit' => ['controller' => 'ReportController', 'action' => 'audit', 'auth' => true, 'admin' => true],
    'reports/logins' => ['controller' => 'ReportController', 'action' => 'logins', 'auth' => true, 'admin' => true],
    'reports/export' => ['controller' => 'ReportController', 'action' => 'export', 'auth' => true, 'admin' => true],
    'reports/export/users' => ['controller' => 'ReportController', 'action' => 'exportUsers', 'auth' => true, 'admin' => true],
    'reports/export/devices' => ['controller' => 'ReportController', 'action' => 'exportDevices', 'auth' => true, 'admin' => true],
    'reports/export/playlists' => ['controller' => 'ReportController', 'action' => 'exportPlaylists', 'auth' => true, 'admin' => true],
    'reports/export/logins' => ['controller' => 'ReportController', 'action' => 'exportLogins', 'auth' => true, 'admin' => true],
    
    // Bezpieczeństwo (admin only)
    'security' => ['controller' => 'SecurityController', 'action' => 'dashboard', 'auth' => true, 'admin' => true],
    'security/ip-rules' => ['controller' => 'SecurityController', 'action' => 'ipRules', 'auth' => true, 'admin' => true],
    'security/ip-rules/add' => ['controller' => 'SecurityController', 'action' => 'addIpRule', 'auth' => true, 'admin' => true],
    'security/ip-rules/delete' => ['controller' => 'SecurityController', 'action' => 'deleteIpRule', 'auth' => true, 'admin' => true],
    'security/unblock-ip' => ['controller' => 'SecurityController', 'action' => 'unblockIp', 'auth' => true, 'admin' => true],
    
    // Profil użytkownika
    'profile' => ['controller' => 'ProfileController', 'action' => 'index', 'auth' => true],
    'profile/edit' => ['controller' => 'ProfileController', 'action' => 'edit', 'auth' => true],
    'profile/avatar/upload' => ['controller' => 'ProfileController', 'action' => 'uploadAvatar', 'auth' => true],
    'profile/avatar/remove' => ['controller' => 'ProfileController', 'action' => 'removeAvatar', 'auth' => true],
    'profile/login-history' => ['controller' => 'ProfileController', 'action' => 'loginHistory', 'auth' => true],
    
    // Notatki per encja (AJAX)
    'entity-notes/list' => ['controller' => 'EntityNotesController', 'action' => 'list', 'auth' => true],
    'entity-notes/add' => ['controller' => 'EntityNotesController', 'action' => 'add', 'auth' => true],
    'entity-notes/update' => ['controller' => 'EntityNotesController', 'action' => 'update', 'auth' => true],
    'entity-notes/delete' => ['controller' => 'EntityNotesController', 'action' => 'delete', 'auth' => true],
    'entity-notes/toggle-pin' => ['controller' => 'EntityNotesController', 'action' => 'togglePin', 'auth' => true],
    
    // Ustawienia urządzeń
    'settings/definitions' => ['controller' => 'SettingController', 'action' => 'definitions', 'auth' => true, 'admin' => true],
    'settings/add-definition' => ['controller' => 'SettingController', 'action' => 'addDefinition', 'auth' => true, 'admin' => true],
    'settings/edit-definition' => ['controller' => 'SettingController', 'action' => 'editDefinition', 'auth' => true, 'admin' => true],
    'settings/delete-definition' => ['controller' => 'SettingController', 'action' => 'deleteDefinition', 'auth' => true, 'admin' => true],
    'settings/presets' => ['controller' => 'SettingController', 'action' => 'presets', 'auth' => true, 'admin' => true],
    'settings/add-preset' => ['controller' => 'SettingController', 'action' => 'addPreset', 'auth' => true, 'admin' => true],
    'settings/edit-preset' => ['controller' => 'SettingController', 'action' => 'editPreset', 'auth' => true, 'admin' => true],
    'settings/delete-preset' => ['controller' => 'SettingController', 'action' => 'deletePreset', 'auth' => true, 'admin' => true],
    'settings/global' => ['controller' => 'SettingController', 'action' => 'global', 'auth' => true, 'admin' => true],
    'settings/reseller' => ['controller' => 'SettingController', 'action' => 'reseller', 'auth' => true],
    'settings/user' => ['controller' => 'SettingController', 'action' => 'user', 'auth' => true],
    'settings/device' => ['controller' => 'SettingController', 'action' => 'device', 'auth' => true],
    'settings/my' => ['controller' => 'SettingController', 'action' => 'my', 'auth' => true],
];
