<?php
use Illuminate\Support\Facades\Route; use App\Http\Controllers\FrontController; use App\Http\Controllers\AuthController; use App\Http\Controllers\SitemapController; use App\Http\Controllers\Admin\{DashboardController,SettingsController,AdsController,PagesController,GenresController,MoviesController,ShowsController,SeasonsController,EpisodesController,StorageController,TmdbBulkImportController};
Route::get('/sitemap.xml', [SitemapController::class, 'index'])->name('sitemap');
Route::get('/sitemaps/static.xml', [SitemapController::class, 'static'])->name('sitemap.static');
Route::get('/sitemaps/movies-{page}.xml', [SitemapController::class, 'movies'])->whereNumber('page')->name('sitemap.movies');
Route::get('/sitemaps/shows-{page}.xml', [SitemapController::class, 'shows'])->whereNumber('page')->name('sitemap.shows');
Route::get('/',[FrontController::class,'home'])->name('home'); Route::get('/movies',[FrontController::class,'movies'])->name('movies'); Route::get('/tv-shows',[FrontController::class,'shows'])->name('shows'); Route::get('/movie/{movie}',[FrontController::class,'movie'])->name('movie'); Route::get('/show/{show}',[FrontController::class,'show'])->name('show'); Route::get('/genre/{genre:slug}',[FrontController::class,'genre'])->name('genre'); Route::get('/page/{page}',[FrontController::class,'page'])->name('page');
Route::get('/admin/login',[AuthController::class,'show'])->name('admin.login'); Route::post('/admin/login',[AuthController::class,'login'])->middleware('throttle:5,1')->name('admin.login.post');
Route::prefix('admin')->name('admin.')->middleware('admin')->group(function(){Route::post('/logout',[AuthController::class,'logout'])->name('logout');Route::get('/',[DashboardController::class,'index'])->name('dashboard');Route::get('/storage',[StorageController::class,'edit'])->name('storage');Route::post('/storage',[StorageController::class,'update'])->name('storage.update');Route::post('/storage/test',[StorageController::class,'test'])->middleware('throttle:10,1')->name('storage.test');Route::get('/settings',[SettingsController::class,'edit'])->name('settings');Route::post('/settings',[SettingsController::class,'update'])->name('settings.update');Route::get('/ads',[AdsController::class,'index'])->name('ads');Route::post('/ads',[AdsController::class,'store'])->name('ads.store');Route::post('/ads/{ad}/toggle',[AdsController::class,'toggle'])->name('ads.toggle');Route::delete('/ads/{ad}',[AdsController::class,'destroy'])->name('ads.destroy');Route::get('/pages',[PagesController::class,'index'])->name('pages');Route::post('/pages',[PagesController::class,'store'])->name('pages.store');Route::post('/pages/{page}/toggle',[PagesController::class,'toggle'])->name('pages.toggle');Route::delete('/pages/{page}',[PagesController::class,'destroy'])->name('pages.destroy');Route::get('/genres',[GenresController::class,'index'])->name('genres');Route::post('/genres/sync',[GenresController::class,'sync'])->name('genres.sync');Route::post('/genres',[GenresController::class,'store'])->name('genres.store');Route::post('/genres/{genre}/toggle',[GenresController::class,'toggle'])->name('genres.toggle');Route::delete('/genres/{genre}',[GenresController::class,'destroy'])->name('genres.destroy');Route::get('/tmdb-bulk',[TmdbBulkImportController::class,'index'])->name('tmdb-bulk.index');Route::post('/tmdb-bulk/discover',[TmdbBulkImportController::class,'discover'])->middleware('throttle:30,1')->name('tmdb-bulk.discover');Route::post('/tmdb-bulk/import-one',[TmdbBulkImportController::class,'importOne'])->middleware('throttle:120,1')->name('tmdb-bulk.import-one');Route::post('/tmdb-bulk/import-season',[TmdbBulkImportController::class,'importSeason'])->middleware('throttle:120,1')->name('tmdb-bulk.import-season');Route::get('/movies',[MoviesController::class,'index'])->name('movies.index');Route::get('/movies/create',[MoviesController::class,'create'])->name('movies.create');Route::post('/movies/import',[MoviesController::class,'import'])->name('movies.import');Route::get('/movies/{movie}/edit',[MoviesController::class,'edit'])->name('movies.edit');Route::put('/movies/{movie}',[MoviesController::class,'update'])->name('movies.update');Route::post('/movies/{movie}/toggle',[MoviesController::class,'toggle'])->name('movies.toggle');Route::delete('/movies/{movie}',[MoviesController::class,'destroy'])->name('movies.destroy');Route::get('/shows',[ShowsController::class,'index'])->name('shows.index');Route::get('/shows/create',[ShowsController::class,'create'])->name('shows.create');Route::post('/shows/import',[ShowsController::class,'import'])->name('shows.import');Route::post('/shows/{show}/toggle',[ShowsController::class,'toggle'])->name('shows.toggle');Route::delete('/shows/{show}',[ShowsController::class,'destroy'])->name('shows.destroy');Route::get('/seasons',[SeasonsController::class,'index'])->name('seasons');Route::post('/seasons/import',[SeasonsController::class,'import'])->name('seasons.import');Route::post('/seasons/{season}/toggle',[SeasonsController::class,'toggle'])->name('seasons.toggle');Route::delete('/seasons/{season}',[SeasonsController::class,'destroy'])->name('seasons.destroy');Route::get('/episodes',[EpisodesController::class,'index'])->name('episodes');Route::post('/episodes/{episode}/toggle',[EpisodesController::class,'toggle'])->name('episodes.toggle');Route::delete('/episodes/{episode}',[EpisodesController::class,'destroy'])->name('episodes.destroy');});
