<?php

declare(strict_types=1);

namespace Kylin\Cadpa;

use Illuminate\Support\ServiceProvider;
use Kylin\Cadpa\Services\CadpaService;

/**
 * CADPA 适龄提示与版号合规服务提供者
 */
final class CadpaServiceProvider extends ServiceProvider
{
    public function register(): void
    {
        $this->mergeConfigFrom(
            __DIR__ . '/../config/kylin-cadpa.php',
            'kylin-cadpa'
        );

        $this->app->singleton(CadpaService::class);
    }

    public function boot(): void
    {
        if ($this->app->runningInConsole()) {
            $this->publishes([
                __DIR__ . '/../config/kylin-cadpa.php' => config_path('kylin-cadpa.php'),
            ], 'kylin-cadpa-config');
        }
    }
}
