<?php

/**
 * ITSWEBER CMS – Frontend Routes
 */

use App\Http\Controllers\PageController;
use App\Http\Controllers\BlogController;
use App\Http\Controllers\GalleryController;

/** @var \App\Core\Router $router */

// Health-Check Endpoint (B2 v3.3.0)
$router->get('/api/health', 'App\Http\Controllers\HealthController@index');

// XML Sitemap + RSS Feed
$router->get('/sitemap.xml', 'App\Http\Controllers\SitemapController@index');
$router->get('/rss',         'App\Http\Controllers\RssController@blogFeed');
$router->get('/feed',        'App\Http\Controllers\RssController@blogFeed');

// Homepage
$router->get('/', 'App\Http\Controllers\PageController@home');

// Blog – specific routes BEFORE the dynamic {slug} catch-all to avoid shadowing
$router->get('/blog', 'App\Http\Controllers\BlogController@index');
$router->get('/blog/category/{slug}', 'App\Http\Controllers\BlogController@category');
$router->get('/blog/tag/{slug}', 'App\Http\Controllers\BlogController@tag');
$router->get('/blog/{slug}', 'App\Http\Controllers\BlogController@show');

// Gallery
$router->get('/gallery', 'App\Http\Controllers\GalleryController@index');
$router->get('/gallery/{slug}', 'App\Http\Controllers\GalleryController@album');

// Events (Phase 4b) – specific routes BEFORE the dynamic {slug} catch-all (ADR-014)
$router->get('/events', 'App\Http\Controllers\EventController@index');
$router->get('/events/category/{slug}', 'App\Http\Controllers\EventController@category');
$router->get('/events/{slug}', 'App\Http\Controllers\EventController@show');

// Downloads (Phase 8) – specific routes BEFORE the dynamic {slug} catch-all (ADR-014)
$router->get('/download', 'App\Http\Controllers\DownloadController@index');
$router->get('/download/category/{slug}', 'App\Http\Controllers\DownloadController@category');
$router->get('/download/{slug}', 'App\Http\Controllers\DownloadController@show');

// Search
$router->get('/search', 'App\Http\Controllers\SearchController@index');

// Contact (if template exists)
$router->get('/contact', 'App\Http\Controllers\PageController@contact');
$router->post('/contact', 'App\Http\Controllers\PageController@contactSubmit');

// Dynamic pages (must be last – catch-all for slugs)
$router->get('/{slug}', 'App\Http\Controllers\PageController@show');
