<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Illuminate\Pagination\Paginator;
use App\Library\VK\VkApiClient;
use GuzzleHttp\Client as GuzzleHttpClient;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Register any application services.
     */
    public function register(): void
    {
        $this->app->singleton(VkApiClient::class, function ($app) {
            return new VkApiClient(
                new GuzzleHttpClient(), // Создаем экземпляр Guzzle
                config('services.vk.token'),   // Берем из config/services.php
                config('services.vk.url'), // Добавляем URL api
                config('services.vk.version'),  // Берем из config/services.php
            );
        });
    }

    /**
     * Bootstrap any application services.
     */
    public function boot(): void
    {
        Paginator::useBootstrap();
    }
}
