<?php

namespace Kylin\Dictionary;

use Illuminate\Support\ServiceProvider;
use Kylin\Dictionary\Services\DictionaryService;

/**
 * 数据字典服务提供者
 *
 * 提供系统数据字典管理功能，支持字典类型和字典条目的
 * 增删改查、缓存管理、树形结构展示。
 */
class DictionaryServiceProvider extends ServiceProvider
{
    public function register(): void
    {
        $this->mergeConfigFrom(__DIR__ . '/../config/kylin-dictionary.php', 'kylin-dictionary');
        $this->app->singleton(DictionaryService::class);
        $this->app->singleton('kylin-dictionary', DictionaryService::class);
    }

    public function boot(): void
    {
        $this->publishes([__DIR__ . '/../config/kylin-dictionary.php' => config_path('kylin-dictionary.php')], 'kylin-dictionary-config');
        $this->loadMigrationsFrom(__DIR__ . '/../database/migrations');
        $this->loadRoutesFrom(__DIR__ . '/../routes/api.php');
    }
}
