<?php

namespace KupShop\KupShopBundle\EventListener;

use KupShop\KupShopBundle\Event\SharedDBUpdateEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class SharedDBUpdateListener implements EventSubscriberInterface
{
    public static function getSubscribedEvents()
    {
        return [
            SharedDBUpdateEvent::NAME => [
                ['updateDeliveries_BalikNaPostu', 200],
                ['updateDeliveries_BalikDoRuky', 200],
                ['updateDeliveries_SlovenskaPosta', 200],
                ['updateDeliveries_SPBalikoBOX', 200],
                ['updateDeliveries_Zasilkovna', 200],
                ['updateDeliveries_PPLParcelShop', 200],
                ['updateDeliveries_Balikovna', 200],
                ['updateDeliveries_PPL', 200],
                ['updateDeliveries_GLSParcelShop', 200],
                ['updateDeliveries_DPDPickup', 200],
                ['updateDeliveries_UrgentCargus', 200],
                ['updateDeliveries_GeisPoint', 200],
                ['updateDeliveries_Paczkomaty', 200],
                ['updateDeliveries_Ulozenka', 200],
                ['updateDeliveries_InTimePoint', 200],
                ['updateDeliveries_DPD', 200],
                ['updateCurrencyRates', 200],
            ],
        ];
    }

    public function updateDeliveries_BalikNaPostu()
    {
        $baliknapostu = \Delivery::getClass('BalikNaPostu');
        $baliknapostu->import();
    }

    public function updateDeliveries_BalikDoRuky()
    {
        $balikdoruky = \Delivery::getClass('BalikDoRuky');
        $balikdoruky->import();
    }

    public function updateDeliveries_SlovenskaPosta()
    {
        $slovenskaposta = \Delivery::getClass('SlovenskaPosta');
        $slovenskaposta->import();
    }

    public function updateDeliveries_SPBalikoBOX()
    {
        $SPBalikoBOX = \Delivery::getClass('SPBalikoBOX');
        $SPBalikoBOX->importFromBalikobot();
    }

    public function updateDeliveries_Zasilkovna()
    {
        $zasilkovna = \Delivery::getClass('Zasilkovna');
        $zasilkovna->import();
    }

    public function updateDeliveries_PPLParcelShop()
    {
        $PPLParcelShop = \Delivery::getClass('PPLParcelShop');
        $PPLParcelShop->importFromBalikobot();
    }

    public function updateDeliveries_Balikovna()
    {
        $balikovna = \Delivery::getClass('Balikovna');
        $balikovna->import();
    }

    public function updateDeliveries_PPL()
    {
        $PPL = \Delivery::getClass('PPL');
        $PPL->import();
    }

    public function updateDeliveries_GLSParcelShop()
    {
        $GLSParcelShop = \Delivery::getClass('GLSParcelShop');
        $GLSParcelShop->importFromBalikobot();
    }

    public function updateDeliveries_DPDPickup()
    {
        $DPDPickup = \Delivery::getClass('DPDPickup');
        $DPDPickup->importFromBalikobot();
    }

    public function updateDeliveries_UrgentCargus()
    {
        $delivery = \Delivery::getClass('UrgentCargus');
        $delivery->import();
    }

    public function updateDeliveries_GeisPoint()
    {
        $GeisPoint = \Delivery::getClass('GeisPoint');
        $GeisPoint->importFromBalikobot();
    }

    public function updateDeliveries_Paczkomaty()
    {
        $Paczkomaty = \Delivery::getClass('Paczkomaty');
        $Paczkomaty->importFromBalikobot();
    }

    public function updateDeliveries_Ulozenka()
    {
        $ulozenka = \Delivery::getClass('Ulozenka');
        $ulozenka->importFromBalikobot();
    }

    public function updateDeliveries_InTimePoint()
    {
        $inTimePoint = \Delivery::getClass('InTimePoint');
        $inTimePoint->importFromBalikobot();
    }

    public function updateDeliveries_DPD()
    {
        $DPD = \Delivery::getClass('DPD');
        $DPD->import();
    }

    public function updateCurrencyRates()
    {
        \CNB::updateSharedCurrencies();
    }
}
