<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\URL;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Register any application services.
     */
    public function register(): void
    {
        //
    }

    /**
     * Bootstrap any application services.
     */
    public function boot(): void
    {
        // MySQL 5.7 compatibility: Set default string length to 191
        Schema::defaultStringLength(191);

        // Force the root URL so Laravel's url()/route() helpers never pick up
        // a subdirectory path from the server environment (fixes sshia/public/ bug).
        URL::forceRootUrl(config('app.url'));

        // Force HTTPS scheme in production to prevent HTTP/HTTPS mismatches
        // behind Hepsia's reverse proxy.
        if (config('app.env') === 'production') {
            URL::forceScheme('https');
        }

        // ThemeComposer removed — InjectTheme middleware already shares
        // themeCssVariables and activeTheme with all views via view()->share().
    }
}
