<?php

use CodeIgniter\Router\RouteCollection;

/**
 * @var RouteCollection $routes
 */
$routes->get('/', 'Home::index');
$routes->get('about', 'Home::about');
$routes->get('products', 'Home::products');
$routes->get('products/category/(:segment)', 'Home::products/$1');
$routes->get('product/(:segment)', 'Home::productDetail/$1');
$routes->match(['get', 'post'], 'contact', 'Home::contact');
$routes->post('request-samples', 'Home::requestSamples');
$routes->get('certification', 'Home::certification');

// SEO
$routes->get('sitemap.xml', 'Sitemap::index');
$routes->get('robots.txt', 'Robots::index');
$routes->get('gallery', 'Home::gallery');

// Admin Routes
$routes->group('admin', ['namespace' => 'App\Controllers\Admin'], static function ($routes) {
    $routes->match(['get', 'post'], 'login', 'Auth::login');
    $routes->get('logout', 'Auth::logout');
    $routes->get('dashboard', 'Dashboard::index');
    $routes->match(['get', 'post'], 'profile', 'Profile::index');
    $routes->match(['get', 'post'], 'settings', 'Settings::index');
    $routes->get('pages', 'Pages::index');
    $routes->match(['get', 'post'], 'pages/edit/(:num)', 'Pages::edit/$1');
    
    // Categories Routes
    $routes->get('categories', 'Categories::index');
    $routes->match(['get', 'post'], 'categories/create', 'Categories::create');
    $routes->match(['get', 'post'], 'categories/edit/(:num)', 'Categories::edit/$1');
    $routes->get('categories/delete/(:num)', 'Categories::delete/$1');

    // Products Routes
    $routes->get('products', 'Products::index');
    $routes->match(['get', 'post'], 'products/create', 'Products::create');
    $routes->match(['get', 'post'], 'products/edit/(:num)', 'Products::edit/$1');
    $routes->get('products/delete/(:num)', 'Products::delete/$1');
    // Banners Routes
    $routes->get('banners', 'Banners::index');
    $routes->match(['get', 'post'], 'banners/create', 'Banners::create');
    $routes->match(['get', 'post'], 'banners/edit/(:num)', 'Banners::edit/$1');
    $routes->get('banners/delete/(:num)', 'Banners::delete/$1');

    // Certifications Routes
    $routes->get('certifications', 'Certifications::index');
    $routes->match(['get', 'post'], 'certifications/create', 'Certifications::create');
    $routes->match(['get', 'post'], 'certifications/edit/(:num)', 'Certifications::edit/$1');
    $routes->get('certifications/delete/(:num)', 'Certifications::delete/$1');

    // Gallery Routes
    $routes->get('gallery', 'Gallery::index');
    $routes->match(['get', 'post'], 'gallery/create', 'Gallery::create');
    $routes->get('gallery/delete/(:num)', 'Gallery::delete/$1');

    // Enquiries Routes
    $routes->get('enquiries', 'Enquiries::index');
    $routes->get('enquiries/view/(:num)', 'Enquiries::view/$1');
    $routes->get('enquiries/status/(:num)/(:segment)', 'Enquiries::status/$1/$2');
    $routes->get('enquiries/export', 'Enquiries::export');
});
