<?php

Route::group(['prefix' => 'peertube'], function () {
  Route::any('/', 'Peertube\Home@index');
  Route::any('/home', 'Peertube\Home@index');

  Route::any('/a/{id}/{cat?}', 'Peertube\Account@index');
  Route::any('/c/{id}/{cat?}/{page?}', 'Peertube\Channel@index');
  Route::any('/w/{id}', 'Peertube\Watch@index');

  Route::get('/logout', 'Peertube\Logout@logout');
  Route::group(['prefix' => 'login'], function () {
    Route::get('/', 'Peertube\Login@index');
    Route::post('/', 'Peertube\Login@login');
  });
  Route::any('/signup', 'Peertube\Signup@index');

  Route::any('/about', 'Peertube\About@index');

  Route::group(['prefix' => 'my-account'], function () {
    Route::any('/', 'Peertube\Myaccount\Settings@index');
    Route::any('/settings', 'Peertube\Myaccount\Settings@index');
    Route::group(['prefix' => 'notifications'], function () {
      Route::post('/read', 'Peertube\Myaccount\Notification@read');
      Route::post('/readAll', 'Peertube\Myaccount\Notification@readAll');
      Route::get('/{page?}', 'Peertube\Myaccount\Notification@index');
    });
    Route::any('/applications', 'Peertube\Myaccount\Applications@index');
    Route::group(['prefix' => 'blocklist'], function () {
      Route::any('/', 'Peertube\Myaccount\Blocklist\Accounts@index');
      Route::any('/accounts', 'Peertube\Myaccount\Blocklist\Accounts@index');
      Route::any('/servers', 'Peertube\Myaccount\Blocklist\Servers@index');
    });
  });
  Route::any('/my-library', 'Peertube\Mylibrary@index');

  Route::group(['prefix' => 'admin'], function () {
    Route::any('/', 'Peertube\Admin\Users@index');
    Route::any('/users', 'Peertube\Admin\Users@index');
  });

  Route::group(['prefix' => 'my-library'], function () {
    Route::any('/', 'Peertube\Mylibrary\Videochannels@index');
    Route::any('/videos', 'Peertube\Mylibrary\Videos@index');
    Route::any('/video-playlists', 'Peertube\Mylibrary\Videoplaylists@index');

    Route::group(['prefix' => 'history'], function () {
      Route::any('/', 'Peertube\Mylibrary\History@index');
      Route::any('/videos', 'Peertube\Mylibrary\History\Videos@index');
    });
  });

  Route::group(['prefix' => 'videos'], function () {
    Route::any('/', 'Peertube\Videos\Local@index');
    Route::any('/subscriptions', 'Peertube\Videos\Subscriptions@index');
    Route::any('/overview/{page?}', 'Peertube\Videos\Overview@index');
    Route::any('/trending/{page?}', 'Peertube\Videos\Trending@index');
    Route::any('/recently-added/{page?}', 'Peertube\Videos\Recentlyadded@index');
    Route::any('/local/{page?}', 'Peertube\Videos\Local@index');
    Route::any('/upload', 'Peertube\Videos\Upload@index');
  });
});
