<?php

declare(strict_types=1);

namespace Kylin\Education;

use Illuminate\Support\ServiceProvider;

/**
 * 教育系统服务提供者
 *
 * 提供在线教育平台核心功能：
 *  - 课程管理（Course/Chapter/Category）
 *  - 考试管理（Exam/Question/Attempt）
 *  - 学生管理（Student/Enrollment/Classroom）
 *  - 课表排课（Schedule）
 */
class EducationServiceProvider extends ServiceProvider
{
    public function register(): void
    {
        $this->mergeConfigFrom(
            __DIR__ . '/../config/kylin-education.php',
            'kylin-education'
        );
    }

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

            $this->loadMigrationsFrom(__DIR__ . '/../database/migrations');
        }

        $this->loadRoutesFrom(__DIR__ . '/../routes/api.php');
    }
}
