<?php

declare(strict_types=1);

namespace Autogedal\AwbRetry\Model;

use Eadesigndev\Awb\Model\Sources\CarrierType;
class PickupNameResolver
{
    public function __construct(
        private readonly \Eadesigndev\Urgent\Model\Sources\PickupId $urgentPickupId,
        private readonly \Eadesigndev\FanCourier\Model\Sources\PickupId $fanPickupId,
        private readonly \Eadesigndev\DPD\Model\Sources\PickupId $dpdPickupId,
        private readonly \Eadesigndev\GLS\Model\Sources\PickupId $glsPickupId,
        private readonly \Eadesigndev\DragonStar\Model\Sources\PickupId $dragonPickupId,
        private readonly \Eadesigndev\NemoExpress\Model\Sources\PickupId $nemoPickupId,
        private readonly \Eadesigndev\Sameday\Model\Sources\PickupId $samedayPickupId
    ) {
    }

    public function resolve(int $carrierId): array
    {
        return match ($carrierId) {
            CarrierType::URGENT_CURRIER => $this->urgentPickupId->getAvailable(),
            CarrierType::FAN_CURRIER => $this->fanPickupId->getAvailable(),
            CarrierType::DPD => $this->dpdPickupId->getAvailable(),
            CarrierType::GLS => $this->glsPickupId->getAvailable(),
            CarrierType::DRAGON_STAR => $this->dragonPickupId->getAvailable(),
            CarrierType::NEMO_EXPRESS => $this->nemoPickupId->getAvailable(),
            CarrierType::SAMEDAY => $this->samedayPickupId->getAvailable(),
            default => [],
        };
    }
}
