<?php

use XcVm\Core\Http\Router;
use XcVm\Domain\Epg\EPG;
use XcVm\Public\Controllers\Admin\AdminLogoutController;
use XcVm\Public\Controllers\Admin\AdminResizeController;
use XcVm\Public\Controllers\Admin\AjaxController;
use XcVm\Public\Controllers\Admin\ArchiveController;
use XcVm\Public\Controllers\Admin\AsnsController;
use XcVm\Public\Controllers\Admin\BackupsController;
use XcVm\Public\Controllers\Admin\BouquetController;
use XcVm\Public\Controllers\Admin\BouquetListController;
use XcVm\Public\Controllers\Admin\BouquetOrderController;
use XcVm\Public\Controllers\Admin\BouquetSortController;
use XcVm\Public\Controllers\Admin\CacheController;
use XcVm\Public\Controllers\Admin\ChannelOrderController;
use XcVm\Public\Controllers\Admin\ClientLogController;
use XcVm\Public\Controllers\Admin\CodeController;
use XcVm\Public\Controllers\Admin\CodeEditController;
use XcVm\Public\Controllers\Admin\CreatedChannelController;
use XcVm\Public\Controllers\Admin\CreatedChannelListController;
use XcVm\Public\Controllers\Admin\CreatedChannelMassController;
use XcVm\Public\Controllers\Admin\CreditLogsController;
use XcVm\Public\Controllers\Admin\DashboardController;
use XcVm\Public\Controllers\Admin\EditProfileController;
use XcVm\Public\Controllers\Admin\EnigmaController;
use XcVm\Public\Controllers\Admin\EnigmaMassController;
use XcVm\Public\Controllers\Admin\EnigmasController;
use XcVm\Public\Controllers\Admin\EpgController;
use XcVm\Public\Controllers\Admin\EpgListController;
use XcVm\Public\Controllers\Admin\EpgViewController;
use XcVm\Public\Controllers\Admin\EpisodeController;
use XcVm\Public\Controllers\Admin\EpisodeListController;
use XcVm\Public\Controllers\Admin\EpisodeMassController;
use XcVm\Public\Controllers\Admin\FingerprintController;
use XcVm\Public\Controllers\Admin\GroupController;
use XcVm\Public\Controllers\Admin\GroupEditController;
use XcVm\Public\Controllers\Admin\HmacController;
use XcVm\Public\Controllers\Admin\HmacEditController;
use XcVm\Public\Controllers\Admin\IpController;
use XcVm\Public\Controllers\Admin\IpEditController;
use XcVm\Public\Controllers\Admin\IspController;
use XcVm\Public\Controllers\Admin\IspEditController;
use XcVm\Public\Controllers\Admin\LineActivityController;
use XcVm\Public\Controllers\Admin\LineController;
use XcVm\Public\Controllers\Admin\LineIpsController;
use XcVm\Public\Controllers\Admin\LineListController;
use XcVm\Public\Controllers\Admin\LineMassController;
use XcVm\Public\Controllers\Admin\LiveConnectionsController;
use XcVm\Public\Controllers\Admin\LoginController;
use XcVm\Public\Controllers\Admin\LoginLogController;
use XcVm\Public\Controllers\Admin\MagController;
use XcVm\Public\Controllers\Admin\MagEventController;
use XcVm\Public\Controllers\Admin\MagMassController;
use XcVm\Public\Controllers\Admin\MagscanSettingsController;
use XcVm\Public\Controllers\Admin\MagsController;
use XcVm\Public\Controllers\Admin\MassDeleteController;
use XcVm\Public\Controllers\Admin\ModulesController;
use XcVm\Public\Controllers\Admin\MovieController;
use XcVm\Public\Controllers\Admin\MovieListController;
use XcVm\Public\Controllers\Admin\MovieMassController;
use XcVm\Public\Controllers\Admin\MysqlSyslogController;
use XcVm\Public\Controllers\Admin\OndemandController;
use XcVm\Public\Controllers\Admin\PackageController;
use XcVm\Public\Controllers\Admin\PackageEditController;
use XcVm\Public\Controllers\Admin\PanelLogController;
use XcVm\Public\Controllers\Admin\PlayerEmbedController;
use XcVm\Public\Controllers\Admin\PostController;
use XcVm\Public\Controllers\Admin\ProcessMonitorController;
use XcVm\Public\Controllers\Admin\ProfileController;
use XcVm\Public\Controllers\Admin\ProfileEditController;
use XcVm\Public\Controllers\Admin\ProviderController;
use XcVm\Public\Controllers\Admin\ProviderEditController;
use XcVm\Public\Controllers\Admin\ProxiesController;
use XcVm\Public\Controllers\Admin\ProxyController;
use XcVm\Public\Controllers\Admin\QueueController;
use XcVm\Public\Controllers\Admin\QuickToolsController;
use XcVm\Public\Controllers\Admin\RadioController;
use XcVm\Public\Controllers\Admin\RadioListController;
use XcVm\Public\Controllers\Admin\RadioMassController;
use XcVm\Public\Controllers\Admin\RecordController;
use XcVm\Public\Controllers\Admin\RestreamLogController;
use XcVm\Public\Controllers\Admin\ReviewController;
use XcVm\Public\Controllers\Admin\RtmpIpController;
use XcVm\Public\Controllers\Admin\RtmpIpEditController;
use XcVm\Public\Controllers\Admin\RtmpMonitorController;
use XcVm\Public\Controllers\Admin\SerieController;
use XcVm\Public\Controllers\Admin\SeriesListController;
use XcVm\Public\Controllers\Admin\SeriesMassController;
use XcVm\Public\Controllers\Admin\ServerController;
use XcVm\Public\Controllers\Admin\ServerInstallController;
use XcVm\Public\Controllers\Admin\ServerListController;
use XcVm\Public\Controllers\Admin\ServerOrderController;
use XcVm\Public\Controllers\Admin\ServerViewController;
use XcVm\Public\Controllers\Admin\SessionController;
use XcVm\Public\Controllers\Admin\SettingsController;
use XcVm\Public\Controllers\Admin\SetupController;
use XcVm\Public\Controllers\Admin\StreamCategoriesController;
use XcVm\Public\Controllers\Admin\StreamCategoryController;
use XcVm\Public\Controllers\Admin\StreamController;
use XcVm\Public\Controllers\Admin\StreamErrorsController;
use XcVm\Public\Controllers\Admin\StreamListController;
use XcVm\Public\Controllers\Admin\StreamMassController;
use XcVm\Public\Controllers\Admin\StreamRankController;
use XcVm\Public\Controllers\Admin\StreamReviewController;
use XcVm\Public\Controllers\Admin\StreamToolsController;
use XcVm\Public\Controllers\Admin\StreamViewController;
use XcVm\Public\Controllers\Admin\TableController;
use XcVm\Public\Controllers\Admin\TheftDetectionController;
use XcVm\Public\Controllers\Admin\TicketController;
use XcVm\Public\Controllers\Admin\TicketsController;
use XcVm\Public\Controllers\Admin\TicketViewController;
use XcVm\Public\Controllers\Admin\TmdbController;
use XcVm\Public\Controllers\Admin\UseragentController;
use XcVm\Public\Controllers\Admin\UseragentsController;
use XcVm\Public\Controllers\Admin\UserController;
use XcVm\Public\Controllers\Admin\UserLogsController;
use XcVm\Public\Controllers\Admin\UserMassController;
use XcVm\Public\Controllers\Admin\UsersController;

/**
 * Admin Routes Definition
 *
 * Defines all HTTP routes for the administrative panel.
 * Maps URL endpoints to their corresponding controller actions.
 *
 * Loaded by the Front Controller when scope = 'admin'.
 *
 * @see public/index.php
 * @see core/Http/Router.php
 *
 * @package XC_VM_Public_Routes
 * @author  Divarion_D <https://github.com/Divarion-D>
 * @copyright 2025-2026 Vateron Media
 * @link    https://github.com/Vateron-Media/XC_VM
 * @license AGPL-3.0 https://www.gnu.org/licenses/agpl-3.0.html
 */

// ─── List Pages ────────────────────────────────────

$router->get('ips', [IpController::class, 'index']);
$router->get('isps', [IspController::class, 'index']);
$router->get('hmacs', [HmacController::class, 'index']);
$router->get('groups', [GroupController::class, 'index']);
$router->get('codes', [CodeController::class, 'index']);
$router->get('packages', [PackageController::class, 'index']);
$router->get('rtmp_ips', [RtmpIpController::class, 'index']);
$router->get('profiles', [ProfileController::class, 'index']);
$router->get('providers', [ProviderController::class, 'index']);
$router->get('theft_detection', [TheftDetectionController::class, 'index']);

// ─── Group E: Bouquets ─────────────────────────────

$router->get('bouquets', [BouquetListController::class, 'index']);
$router->get('bouquet', [BouquetController::class, 'index']);
$router->get('bouquet_order', [BouquetOrderController::class, 'index']);
$router->get('bouquet_sort', [BouquetSortController::class, 'index']);

// ─── Group G: Simple Listings ──────────────────────

$router->get('login_logs', [LoginLogController::class, 'index']);
$router->get('mysql_syslog', [MysqlSyslogController::class, 'index']);
$router->get('mag_events', [MagEventController::class, 'index']);
$router->get('restream_logs', [RestreamLogController::class, 'index']);
$router->get('panel_logs', [PanelLogController::class, 'index']);
$router->get('epgs', [EpgListController::class, 'index']);

// ─── Group D: Servers ──────────────────────────────

$router->get('servers', [ServerListController::class, 'index']);
$router->get('server', [ServerController::class, 'index']);
$router->get('server_view', [ServerViewController::class, 'index']);
$router->get('server_install', [ServerInstallController::class, 'index']);

// ─── Group F: Settings ─────────────────────────────

$router->get('settings', [SettingsController::class, 'index']);
$router->any('modules', [ModulesController::class, 'index']);
$router->get('magscan_settings', [MagscanSettingsController::class, 'index']);

// ─── Group C: Lines ────────────────────────────────

$router->get('lines', [LineListController::class, 'index']);
$router->get('line', [LineController::class, 'index']);
$router->get('line_mass', [LineMassController::class, 'index']);
$router->get('line_activity', [LineActivityController::class, 'index']);
$router->get('line_ips', [LineIpsController::class, 'index']);
$router->get('client_logs', [ClientLogController::class, 'index']);

// ─── Group B: VOD ──────────────────────────────────

$router->get('movies', [MovieListController::class, 'index']);
$router->get('movie', [MovieController::class, 'index']);
$router->get('movie_mass', [MovieMassController::class, 'index']);
$router->get('series', [SeriesListController::class, 'index']);
$router->get('serie', [SerieController::class, 'index']);
$router->get('series_mass', [SeriesMassController::class, 'index']);
$router->get('episodes', [EpisodeListController::class, 'index']);
$router->get('episode', [EpisodeController::class, 'index']);
$router->get('episodes_mass', [EpisodeMassController::class, 'index']);
$router->get('ondemand', [OndemandController::class, 'index']);

// ─── Group A: Streams ──────────────────────────────

$router->get('streams', [StreamListController::class, 'index']);
$router->get('stream', [StreamController::class, 'index']);
$router->get('stream_mass', [StreamMassController::class, 'index']);
$router->get('stream_categories', [StreamCategoriesController::class, 'index']);
$router->get('stream_category', [StreamCategoryController::class, 'index']);
$router->get('stream_errors', [StreamErrorsController::class, 'index']);
$router->get('stream_rank', [StreamRankController::class, 'index']);
$router->any('stream_review', [StreamReviewController::class, 'index']);
$router->get('stream_tools', [StreamToolsController::class, 'index']);
$router->get('stream_view', [StreamViewController::class, 'index']);
$router->get('channel_order', [ChannelOrderController::class, 'index']);
$router->get('created_channel', [CreatedChannelController::class, 'index']);
$router->get('created_channels', [CreatedChannelListController::class, 'index']);
$router->get('created_channel_mass', [CreatedChannelMassController::class, 'index']);
$router->get('live_connections', [LiveConnectionsController::class, 'index']);
$router->get('rtmp_monitor', [RtmpMonitorController::class, 'index']);
$router->get('radio', [RadioController::class, 'index']);
$router->get('radios', [RadioListController::class, 'index']);
$router->get('radio_mass', [RadioMassController::class, 'index']);
$router->get('record', [RecordController::class, 'index']);

// ─── Group H: Pilot Detail Pages ──────────────────

$router->get('ip', [IpEditController::class, 'index']);
$router->get('isp', [IspEditController::class, 'index']);
$router->get('hmac', [HmacEditController::class, 'index']);
$router->get('group', [GroupEditController::class, 'index']);
$router->get('code', [CodeEditController::class, 'index']);
$router->get('package', [PackageEditController::class, 'index']);
$router->get('rtmp_ip', [RtmpIpEditController::class, 'index']);
$router->get('profile', [ProfileEditController::class, 'index']);
$router->get('provider', [ProviderEditController::class, 'index']);

// ─── Group I: Users / Agents ──────────────────────

$router->get('users', [UsersController::class, 'index']);
$router->any('user', [UserController::class, 'index']);
$router->any('user_mass', [UserMassController::class, 'index']);
$router->get('user_logs', [UserLogsController::class, 'index']);
$router->get('useragents', [UseragentsController::class, 'index']);
$router->any('useragent', [UseragentController::class, 'index']);

// ─── Group J: Devices MAG / Enigma ────────────────

$router->get('mags', [MagsController::class, 'index']);
$router->any('mag', [MagController::class, 'index']);
$router->any('mag_mass', [MagMassController::class, 'index']);
$router->get('enigmas', [EnigmasController::class, 'index']);
$router->any('enigma', [EnigmaController::class, 'index']);
$router->any('enigma_mass', [EnigmaMassController::class, 'index']);

// ─── Group K: Tickets / EPG ───────────────────────

$router->get('tickets', [TicketsController::class, 'index']);
$router->any('ticket', [TicketController::class, 'index']);
$router->get('ticket_view', [TicketViewController::class, 'index']);
$router->any('epg', [EpgController::class, 'index']);
$router->get('epg_view', [EpgViewController::class, 'index']);

// ─── Group M: System ──────────────────────────────

$router->get('dashboard', [DashboardController::class, 'index']);
$router->get('backups', [BackupsController::class, 'index']);
$router->any('cache', [CacheController::class, 'index']);
$router->any('process_monitor', [ProcessMonitorController::class, 'index']);
$router->get('queue', [QueueController::class, 'index']);
$router->any('quick_tools', [QuickToolsController::class, 'index']);
$router->any('mass_delete', [MassDeleteController::class, 'index']);
$router->any('server_order', [ServerOrderController::class, 'index']);

// ─── Group N: Misc ────────────────────────────────

$router->get('credit_logs', [CreditLogsController::class, 'index']);
$router->get('edit_profile', [EditProfileController::class, 'index']);
$router->get('fingerprint', [FingerprintController::class, 'index']);
$router->get('proxies', [ProxiesController::class, 'index']);
$router->any('proxy', [ProxyController::class, 'index']);
$router->any('review', [ReviewController::class, 'index']);
$router->any('archive', [ArchiveController::class, 'index']);
$router->get('asns', [AsnsController::class, 'index']);
$router->get('resize', [AdminResizeController::class, 'index']);

// ─── Formerly unrouted pages ─────────────────────────

$router->get('logout', [AdminLogoutController::class, 'index']);
$router->any('player', [PlayerEmbedController::class, 'index']);
$router->any('post', [PostController::class, 'index']);
$router->any('table', [TableController::class, 'index']);
$router->any('api', [AjaxController::class, 'index']);

// ─── Admin-ajax API actions (consumed via $router->dispatchApi() fallback) ───

$router->api('tmdb_search', [TmdbController::class, 'search']);
$router->api('tmdb',        [TmdbController::class, 'details']);

// ─── No-bootstrap pages (login, setup, database, session) ────

$router->get('session', [SessionController::class, 'index']);
$router->any('login', [LoginController::class, 'index']);
$router->any('setup', [SetupController::class, 'index']);
$router->any('database', [SetupController::class, 'database']);
$router->get('index', [LoginController::class, 'index']);