<?php

use CodeIgniter\Router\RouteCollection;

/**
 * @var RouteCollection $routes
 */
$routes->setDefaultNamespace('App\Controllers\Backend');
$routes->setDefaultController('AuthenticationsController');
$routes->setDefaultMethod('actionSignIn');

$routes->get('/', 'AuthenticationsController::actionSignIn');

$routes->add( 'authentication/sign-in', 'AuthenticationsController::actionSignIn' );
$routes->add( 'authentication/sign-out', 'AuthenticationsController::actionSignOut' );

$routes->add( 'dashboard', 'DashboardController::actionDashboard', ['filter' => 'isBackendSignedIn'] );
$routes->add( 'dashboard/send-config-data', 'DashboardController::actionSendConfigData', ['filter' => 'isBackendSignedIn'] );
$routes->add( 'dashboard/reset-config-data', 'DashboardController::actionResetConfigData', ['filter' => 'isBackendSignedIn'] );

$routes->add( 'basic-settings/add', 'BasicSettingsController::actionAdd', ['filter' => 'isBackendSignedIn'] );
$routes->add( 'basic-settings/edit', 'BasicSettingsController::actionEdit', ['filter' => 'isBackendSignedIn'] );
$routes->add( 'basic-settings/view', 'BasicSettingsController::actionView', ['filter' => 'isBackendSignedIn'] );

$routes->add( 'device-settings/com-settings/view', 'DeviceComSettingsController::actionViewComSettings', ['filter' => 'isBackendSignedIn'] );
$routes->add( 'device-settings/com-settings/edit-com-settings', 'DeviceComSettingsController::actionEditComSettings', ['filter' => 'isBackendSignedIn'] );
$routes->add( 'device-settings/com-settings/add-slave-device', 'DeviceComSettingsController::actionAddSlaveDevice', ['filter' => 'isBackendSignedIn'] );
$routes->add( 'device-settings/com-settings/edit-slave-device', 'DeviceComSettingsController::actionEditSlaveDevice', ['filter' => 'isBackendSignedIn'] );
$routes->add( 'device-settings/com-settings/delete-slave-device', 'DeviceComSettingsController::actionDeleteSlaveDevice', ['filter' => 'isBackendSignedIn'] );

$routes->add( 'device-settings/tcp-ip-settings/view', 'DeviceTcpIpSettingsController::actionView', ['filter' => 'isBackendSignedIn'] );
$routes->add( 'device-settings/tcp-ip-settings/add', 'DeviceTcpIpSettingsController::actionAdd', ['filter' => 'isBackendSignedIn'] );
$routes->add( 'device-settings/tcp-ip-settings/edit', 'DeviceTcpIpSettingsController::actionEdit', ['filter' => 'isBackendSignedIn'] );

$routes->add( 'spanning-tree/add', 'SpanningTreeController::actionAdd', ['filter' => 'isBackendSignedIn'] );
$routes->add( 'spanning-tree/edit', 'SpanningTreeController::actionEdit', ['filter' => 'isBackendSignedIn'] );
$routes->add( 'spanning-tree/view', 'SpanningTreeController::actionView', ['filter' => 'isBackendSignedIn'] );

$routes->add( 'upgrade-firmware/view', 'UpgradeFirmwareController::actionView', ['filter' => 'isBackendSignedIn'] );

$routes->cli( 'script/mqtt/subscribe', '\App\Controllers\Scripts\MosquittoMqtt\SubscribeMqttController::index' );
$routes->cli( 'script/mqtt/subscribe/(:any)/(:any)', '\App\Controllers\Scripts\MosquittoMqtt\SubscribeMqttController::index/$1/$2' );
