<?php


/*
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
*/

require 'db.php';

//header('Content-Type: application/json');

// Parse URL
$uri = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
$uri = explode('/', trim($uri, '/'));

// Example: /orderbase/publication/unreadAndReadNotifications/buyer/mockuser@example.com
$routeGroup = $uri[1] ?? null; // "publication"
$routeFile = __DIR__ . "/routes/{$routeGroup}.php";

if (file_exists($routeFile)) {
    require $routeFile;
} else {
    http_response_code(404);
    echo json_encode(["error" => "Route group '{$routeGroup}' not found"]);
}
