<?php

namespace App\Domains\Billing\Services;

use App\Domains\Billing\Contracts\PaymentProviderDriver;
use App\Domains\Billing\Providers\WhishPayProvider;
use InvalidArgumentException;

class PaymentProviderManager
{
    public function __construct(
        protected WhishPayProvider $whishProvider,
    ) {
    }

    public function driver(string $providerKey): PaymentProviderDriver
    {
        return match ($providerKey) {
            'whish' => $this->whishProvider,
            default => throw new InvalidArgumentException("Unsupported payment provider [{$providerKey}]."),
        };
    }
}
