<?php

namespace App\Providers;

use App\Support\Translation\DatabaseMergeLoader;
use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Register any application services.
     */
    public function register(): void
    {
        // Layer per-locale DB translation overrides over the lang/*.php
        // defaults (docs/features/multi-language.md §3). Extends the
        // deferred `translation.loader` binding — the extender is queued
        // and applied when the translator first resolves it.
        $this->app->extend('translation.loader', fn ($loader) => new DatabaseMergeLoader($loader));
    }

    /**
     * Bootstrap any application services.
     */
    public function boot(): void
    {
        // System-wide default pagination view — every `->links()` call
        // across the admin renders with the same chrome (caption +
        // numbered nav) instead of Laravel's stock Tailwind 3 markup.
        \Illuminate\Pagination\Paginator::defaultView('vendor.pagination.system');
        \Illuminate\Pagination\Paginator::defaultSimpleView('vendor.pagination.system');
    }
}
