<?php

namespace App\Support\Providers;

use App\Models\ProviderConnection;
use App\Models\ManagedEnvironment;
use App\Support\ReasonTranslation\ReasonPresenter;

final class ProviderNextStepsRegistry
{
    public function __construct(
        private readonly ReasonPresenter $reasonPresenter,
    ) {}

    /**
     * @return array<int, array{label: string, url: string}>
     */
    public function forReason(ManagedEnvironment $tenant, string $reasonCode, ?ProviderConnection $connection = null): array
    {
        $envelope = $this->reasonPresenter->forProviderReason($tenant, $reasonCode, $connection, 'helper_copy');

        return $envelope?->toLegacyNextSteps() ?? [];
    }
}
