<?php

use Illuminate\Support\Facades\Route;
use App\Http\Controllers\SportController;
use App\Http\Controllers\AssetController;
use App\Http\Controllers\SportsController;

// Main routes
Route::get('/', [SportController::class, 'index'])->name('home');
Route::get('/news/{slug}', [SportController::class, 'news'])->name('news');
Route::get('/search', [SportController::class, 'search'])->name('search');
Route::get('/category/{slug}', [SportController::class, 'category'])->name('category');
Route::get('/post/{slug}', [SportController::class, 'post'])->name('post');

// Match Routes
Route::get('/matches', [SportController::class, 'matches'])->name('matches');
Route::get('/play/{id}', [SportController::class, 'play'])->name('play');
Route::get('/api/stream', [SportController::class, 'getStreamUrl'])->name('api.stream');
Route::post('/api/track-time', [SportController::class, 'trackTime'])->name('api.track-time');

// Static pages - direct routes
Route::get('/about', [SportController::class, 'page'])->defaults('slug', 'about')->name('about');
Route::get('/contact', [SportController::class, 'page'])->defaults('slug', 'contact')->name('contact');
Route::get('/privacy', [SportController::class, 'page'])->defaults('slug', 'privacy')->name('privacy');
Route::get('/dmca', [SportController::class, 'page'])->defaults('slug', 'dmca')->name('dmca');

// Generic page route (for any other pages)
Route::get('/page/{slug}', [SportController::class, 'page'])->name('page');



// Sports routes for Sky Sports data
Route::get('/sports', [SportsController::class, 'index'])->name('sports.index');
Route::get('/sports/search', [SportsController::class, 'search'])->name('sports.search');
Route::get('/sports/{sport}/{type}/{idsport}/{id}/{term}', [SportsController::class, 'article'])->name('sports.article');
Route::get('/report/{category}/{term}/{id}', [SportsController::class, 'report'])->name('report.article');
Route::get('/more-sports/{sport}/{type}/{idsport}/{id}/{term}', [SportsController::class, 'article'])->defaults('more', 'more-sports')->name('sports.article.more');
Route::get('/sports/{category}', [SportsController::class, 'category'])->name('sports.category');
// Asset routes
Route::get('/robots.txt', [AssetController::class, 'robots']);
Route::get('/sitemap.xml', [AssetController::class, 'index']);
Route::get('/sitemap-main.xml', [AssetController::class, 'main']);
Route::get('/sitemap-matches.xml', [AssetController::class, 'matches']);
Route::get('/sitemap-sports-articles.xml', [AssetController::class, 'sportsArticles']);
Route::get('/sitemap-keywords-{filename}.xml', [AssetController::class, 'keywords']);
Route::get('/sitemap-posts-{page}.xml', [AssetController::class, 'posts']);