<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/




Route::get('/', 'SwitcherIndexController@switcher');

Route::get('/phpinfo', 'ServerDebugController@debug');

Route::get('/piskoviste','PiskovisteController@get');

Route::prefix('setPass')
    ->name('setPass-')
    ->group(
            static function()
            {
                Route::get('/', 'UsersController@setPassLink')->name('index');
                Route::post('{data}/confirm', 'UsersController@setPassConfirm')->name('confirm');
            }
    );

Route::get('obnovitHeslo','UsersController@obnovitHeslo')->name('obnovitHeslo');
Route::post('obnovitHeslo','UsersController@obnovitHesloCreate')->name('obnovitHeslo');


Auth::routes(['register'=>false, 'verify' => false, 'confirm' => false, 'reset'=> false]);

Route::post('/set_session', 'SessionController@setsession')->name('set_session');

Route::get('{id}/dataModalOvladani','ModalController@getDataOvladani')->name('dataModalOvladani');
Route::post('/dataModalOvladani','ModalController@getRefreshGraf')->name('dataModalOvladani');

Route::prefix('admin')
    ->middleware('auth')
    ->group(
            static function ()
            {
                Route::get('/', 'AdminController@index')->name('admin');
                Route::get('/prehled', 'PrehledController@index')->name('prehled');
                Route::prefix('velicina')
                    ->name('velicina-')
                    ->group(
                        static function()
                        {
                            Route::get('/','VelicinyController@index')->name('index');
                            Route::get('{nazvosloviVelicin}/edit','VelicinyController@edit')->name('edit');
                            Route::post('{nazvosloviVelicin}/edit','VelicinyController@update')->name('edit');
                            Route::get('/add', 'VelicinyController@showAddForm')->name('add');
                            Route::get('{nazvosloviVelicin}/delete', 'VelicinyController@delete')->name('delete');
                            Route::post('/add', 'VelicinyController@addVelicina')->name('add');
                        }
                    );

                Route::prefix('nastaveniWu')
                    ->name('nastaveniWu-')
                    ->group(
                        static function()
                        {
                            Route::get('/','NastaveniWuController@index')->name('index');
                            Route::get('/add','NastaveniWuController@add')->name('add');
                            Route::post('/add','NastaveniWuController@create')->name('add');
                            Route::get('{data}/edit','NastaveniWuController@edit')->name('edit');
                            Route::post('{data}/edit','NastaveniWuController@update')->name('edit');
                            Route::get('{data}/delete', 'NastaveniWuController@delete')->name('delete');
                            Route::get('{data}/export', 'NastaveniWuController@export')->name('export');
                        }
                    );

                Route::prefix('emails')
                    ->name('emails-')
                    ->group(
                        static function()
                        {
                            Route::get('/','KontrolaPrijmuDatController@index')->name('index');
                            Route::get('/add','KontrolaPrijmuDatController@add')->name('add');
                            Route::post('/add','KontrolaPrijmuDatController@create')->name('add');
                            Route::get('{data}/edit','KontrolaPrijmuDatController@edit')->name('edit');
                            Route::post('{idemails_notify}/edit','KontrolaPrijmuDatController@update')->name('edit');
                            Route::get('{idemails_notify}/delete', 'KontrolaPrijmuDatController@delete')->name('delete');
                        }
                    );

                Route::prefix('apiAuth')
                    ->name('apiAuth-')
                    ->group(
                        static function()
                        {
                            Route::get('/','ApiController@index')->name('index');
                            Route::get('/add','ApiController@add')->name('add');
                            Route::post('/add','ApiController@create')->name('add');
                            Route::get('{idapi_auth}/edit','ApiController@edit')->name('edit');
                            Route::post('{idapi_auth}/edit','ApiController@update')->name('edit');
                            Route::get('{idapi_auth}/delete', 'ApiController@delete')->name('delete');
                        }
                    );

                Route::prefix('emailSet')
                    ->name('emailSet-')
                    ->group(
                        static function()
                        {
                            Route::get('/','EmailController@index')->name('index');
                            Route::get('/testovaci','EmailController@testovaci')->name('testovaci');
                            Route::post('/update','EmailController@updateServer')->name('update');
                            Route::get('/add','EmailController@add')->name('add');
                            Route::post('/add','EmailController@create')->name('add');
                            Route::get('{idemail_sender_define}/edit','EmailController@edit')->name('edit');
                            Route::post('{idemail_sender_define}/edit','EmailController@update')->name('edit');
                            Route::get('{idemail_sender_define}/delete', 'EmailController@delete')->name('delete');
                        }
                    );

                Route::prefix('ban')
                    ->name('ban-')
                    ->group(
                        static function()
                        {
                            Route::get('/','AutomatickeBanovaniController@index')->name('index');
                            Route::get('/add','AutomatickeBanovaniController@add')->name('add');
                            Route::post('/add','AutomatickeBanovaniController@create')->name('add');
                            Route::get('{idban_automat}/edit','AutomatickeBanovaniController@edit')->name('edit');
                            Route::post('{idban_automat}/edit','AutomatickeBanovaniController@update')->name('edit');
                            Route::get('{idban_automat}/delete', 'AutomatickeBanovaniController@delete')->name('delete');
                        }
                    );

                Route::prefix('topic')
                    ->name('topic-')
                    ->group(
                        static function()
                        {
                            Route::get('/','TopicController@index')->name('index');
                            Route::post('/update','TopicController@updateServer')->name('update');
                            Route::get('/add','TopicController@add')->name('add');
                            Route::post('/add','TopicController@create')->name('add');
                            Route::get('{idmqtt_topic}/edit','TopicController@edit')->name('edit');
                            Route::post('{idmqtt_topic}/edit','TopicController@update')->name('edit');
                            Route::get('{idmqtt_topic}/delete', 'TopicController@delete')->name('delete');
                        }
                    );

                Route::prefix('mqtt')
                    ->name('mqtt-')
                    ->group(
                        static function()
                        {
                            Route::get('/','MqttServerSetController@index')->name('index');
                            Route::post('/update','MqttServerSetController@updateServer')->name('update');
                            Route::get('/add','MqttServerSetController@add')->name('add');
                            Route::post('/add','MqttServerSetController@create')->name('add');
                            Route::get('{idmqtt_server_set}/edit','MqttServerSetController@edit')->name('edit');
                            Route::post('{idmqtt_server_set}/edit','MqttServerSetController@update')->name('edit');
                            Route::get('{idmqtt_server_set}/delete', 'MqttServerSetController@delete')->name('delete');
                        }
                    );

                Route::prefix('stanice')
                    ->name('stanice-')
                    ->group(
                        static function ()
                        {
                            Route::get('/', 'StaniceController@index')->name('index');
                            Route::get('{stanice}/edit','StaniceController@edit')->name('edit');
                            Route::get('{stanice}/vypnout','StaniceController@vypnout')->name('vypnout');
                            Route::get('{stanice}/zapnout','StaniceController@zapnout')->name('zapnout');
                            Route::get('{stanice}/ban','StaniceController@ban')->name('ban');
                            Route::get('{stanice}/unban','StaniceController@unban')->name('unban');
                            Route::post('{stanice}/edit','StaniceController@update')->name('edit');
                        }
                    );

                Route::prefix('users')
                    ->name('users-')
                    ->group(
                        static function ()
                        {
                            Route::get('/', 'UsersController@index')->name('index');
                            Route::get('/add', 'UsersController@showAddForm')->name('add');
                            Route::post('/add', 'UsersController@addUser')->name('add');
                            Route::get('{user}/delete', 'UsersController@delete')->name('delete');
                            Route::get('{user}/edit', 'UsersController@edit')->name('edit');
                            Route::post('{user}/edit', 'UsersController@update')->name('edit');
                            Route::get('{user}/changePass', 'UsersController@changePass')->name('changePass');
                            Route::get('{user}/resendPass', 'UsersController@resendPass')->name('resendPass');
                            Route::post('{user}/changePass', 'UsersController@changePassupdate')->name('changePass');
                        }
                    );
            }
        );

