<?php

namespace App\Providers;

use App\Services\BookInformation\BookLookupService;
use App\Services\BookInformation\CachedService;
use App\Services\BookInformation\GoogleBooks;
use Illuminate\Pagination\Paginator;
use Schema;
use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider {
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot() {
        Schema::defaultStringLength(191);
        Paginator::useBootstrap();
    }

    /**
     * Register any application services.
     *
     * @return void
     */
    public function register() {
        $this->app->singleton(BookLookupService::class, function() {
            return new CachedService(new GoogleBooks());
        });
    }
}
