<?php

namespace Kylin\Storage;

use Illuminate\Support\ServiceProvider;
use Kylin\Storage\Services\StorageService;

/**
 * 文件存储服务提供者
 *
 * 提供统一文件存储抽象层，支持多驱动切换：
 *  - 本地存储（Local）
 *  - 云存储（OSS/COS/S3）
 *  - 文件上传、下载、删除等操作
 */
class StorageServiceProvider extends ServiceProvider
{
    public function register(): void
    {
        $this->mergeConfigFrom(__DIR__ . '/../config/kylin-storage.php', 'kylin-storage');
        $this->app->singleton(StorageService::class);
        $this->app->singleton('kylin-storage', StorageService::class);
    }

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