<?php

declare(strict_types=1);

namespace App\Services\Billing;

use InvalidArgumentException;

class BillingServiceFactory
{
    public function make(string $gateway): BillingServiceInterface
    {
        return match ($gateway) {
            'stripe' => app(StripeBillingService::class),
            'paypal' => app(PayPalBillingService::class),
            default => throw new InvalidArgumentException("Unsupported billing gateway: {$gateway}"),
        };
    }

    public function default(): BillingServiceInterface
    {
        return $this->make(config('billing.default_gateway'));
    }
}
