<?php

declare(strict_types=1);

namespace App\Shared\Support;

final class RoutePaths
{
    public static function on(string $prefix): bool
    {
        $uri = (string)($_SERVER['REQUEST_URI'] ?? '');
        $path = (string)parse_url($uri, PHP_URL_PATH);
        return $path === $prefix || str_starts_with($path, $prefix . '/');
    }

    public static function openingStockBase(): string { return '/inventory/opening-stock'; }
    public static function posBase(): string { return '/pos'; }
    public static function posSuspendedBase(): string { return '/pos/suspended'; }
    public static function receiptsBase(): string { return '/sales/receipts'; }
    public static function receiptsForm(): string { return '/sales/receipts/form'; }
    public static function receiptsView(int $id = 0): string { return '/sales/receipts/view' . ($id > 0 ? ('?id=' . $id) : ''); }
    public static function warehouseDocsBase(): string { return '/inventory/warehouse-docs'; }
    public static function warehouseDocsView(int $id = 0): string { return '/inventory/warehouse-docs/view' . ($id > 0 ? ('?id=' . $id) : ''); }
    public static function warehouseDocsPrint(int $id = 0): string { return '/inventory/warehouse-docs/print' . ($id > 0 ? ('?id=' . $id) : ''); }
}
