<?php
declare(strict_types=1);

namespace App\Core\Providers;

use App\Core\App;
use App\Core\ServiceProvider;
use App\Core\Contracts\RuleEngineInterface;
use App\Core\Contracts\PaymentProcessorInterface;
use App\Core\Contracts\StockManagerInterface;
use App\Core\Contracts\WorkflowEngineInterface;
use App\Core\Contracts\JournalServiceInterface;
use App\Modules\Rules\RuleEngineAdapter;
use App\Modules\Payments\PaymentProcessorAdapter;
use App\Modules\Inventory\StockManagerAdapter;
use App\Modules\Workflow\WorkflowEngineAdapter;
use App\Modules\Accounting\JournalServiceAdapter;

final class CoreServiceProvider extends ServiceProvider
{
    public function register(App $app): void
    {
        $app->singleton(RuleEngineInterface::class, fn() => new RuleEngineAdapter());
        $app->singleton(PaymentProcessorInterface::class, fn() => new PaymentProcessorAdapter());
        $app->singleton(StockManagerInterface::class, fn() => new StockManagerAdapter());
        $app->singleton(WorkflowEngineInterface::class, fn() => new WorkflowEngineAdapter());
        $app->singleton(JournalServiceInterface::class, fn() => new JournalServiceAdapter());
    }
}
