<?php

namespace App\Services\RemotePayments;

use Illuminate\Validation\ValidationException;

class PaymentProviderRegistry
{
    public function __construct(private ManualReviewPaymentProvider $manualReview) {}

    public function resolve(string $channel): RemotePaymentProvider
    {
        if ($this->manualReview->supports($channel)) {
            return $this->manualReview;
        }

        throw ValidationException::withMessages(['payment_channel' => 'The selected payment channel is not supported.']);
    }
}
