<?php

declare(strict_types=1);

namespace TechnoArtisan\FilamentCms\Http\Middleware;

use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\URL;
use Symfony\Component\HttpFoundation\Response;

readonly class ForceSsl
{
    /**
     * Handle an incoming request.
     *
     * @param  Closure(Request): (Response)  $next
     */
    public function handle(Request $request, Closure $next): Response
    {
//        URL::forceScheme('https');

//        if (!$request->server('HTTP_X_FORWARDED_SCHEME') && true /*app()->environment(['staging', 'production'])*/) {
//            return redirect()->secure($request->getRequestUri());
//        }

        return $next($request);
    }
}
