<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\URL;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Register any application services.
     */
    public function register(): void
    {
        // 注册 MathRecSys 服务
        $this->app->singleton(\App\Services\MathRecSysService::class, function () {
            return new \App\Services\MathRecSysService();
        });

        // 注册知识图谱服务
        $this->app->singleton(\App\Services\KnowledgeGraphService::class, function ($app) {
            return new \App\Services\KnowledgeGraphService(
                $app->make(\App\Services\MathRecSysService::class)
            );
        });
    }

    /**
     * Bootstrap any application services.
     */
    public function boot(): void
    {
        if (config('app.env') === 'production') {
            URL::forceScheme('https');
        }
    }
}
