<?php

namespace App\Filters;

use CodeIgniter\Filters\FilterInterface;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;

class TimezoneFilter implements FilterInterface
{
    public function before(RequestInterface $request, $arguments = null)
    {
        // Prime the TimeService detection early in the request lifecycle
        try {
            service('timeService')->primeFromRequest($request);
        } catch (\Throwable $e) {
            // ignore; fallback detection will still work lazily
        }
    }

    public function after(RequestInterface $request, ResponseInterface $response, $arguments = null)
    {
        // No-op
    }
}

