<?php

namespace Opencart\Extension\Alsendo\Services;

require_once(DIR_EXTENSION . 'alsendo/src/Enums/PickupType.php');
require_once(DIR_EXTENSION . 'alsendo/src/Enums/Region.php');

use Opencart\Extension\Alsendo\Enums\Region;
use Opencart\Extension\Alsendo\Enums\PickupType;

class PickupTypeService
{
    private string $region;

    public function __construct(string $region)
    {
        $this->region = $region;
    }

    public function getAllowedPickupTypes(): array
    {
        switch ($this->region) {
            case Region::POLAND: return $this->getPolandAllowedTypes();
            case Region::CZECHIA: return $this->getCzechiaAllowedTypes();
            case Region::ROMANIA: return $this->getRomaniaAllowedTypes();
            default: return [];
        }
    }

    private function getPolandAllowedTypes(): array
    {
        return [
            PickupType::SELF,
            PickupType::COURIER,
            PickupType::NO_PICKUP
        ];
    }

    private function getCzechiaAllowedTypes(): array
    {
        return [
            PickupType::ONDEMAND,
            PickupType::OCCASIONAL
        ];
    }

    private function getRomaniaAllowedTypes(): array
    {
        return [
            PickupType::RO_COURIER,
            PickupType::RO_SELF
        ];
    }
}