<?php

namespace App\Services\Courier;

use App\Contracts\CourierProviderInterface;
use App\Exceptions\CourierException;
use App\Services\Courier\Providers\SteadFastCourierProvider;

class CourierProviderManager
{
    public function __construct(
        private readonly SteadFastCourierProvider $steadFastCourierProvider
    ) {
    }

    public function driver(string $provider): CourierProviderInterface
    {
        return match ($provider) {
            'steadfast' => $this->steadFastCourierProvider,
            default => throw new CourierException('Selected courier provider is not supported yet.'),
        };
    }
}
