<?php

namespace Alsendo\AlsendoWrapper\Api\Zaslat\Wrapper;

use Alsendo\AlsendoWrapper\Api\Ecolet\Model\AdditionalService;
use Alsendo\AlsendoWrapper\Api\Zaslat\Model\Order\ZaslatOrderRequest;
use Alsendo\AlsendoWrapper\Api\Zaslat\Model\Order\ZaslatPackage;
use Alsendo\AlsendoWrapper\Api\Zaslat\Model\Order\ZaslatService;
use Alsendo\AlsendoWrapper\Api\Zaslat\Model\Order\ZaslatServiceData;
use Alsendo\AlsendoWrapper\Api\Zaslat\Model\Order\ZaslatShipment;
use Alsendo\AlsendoWrapper\Model\Order\OrderRequest;
use Alsendo\AlsendoWrapper\Model\Shipment;

class OrderValuationRateWrapper
{

    /**
     * Wrap the rate response from the Zaslat API into a form suitable for use with the OrderValuation class.
     *
     * @param array $rate The rate response from the Zaslat API.
     * @return array The wrapped rate response.
     */
    public static function wrap(array $rate): array
    {
        $rate['priceTable']['price'] = $rate['price']['value'];
        $rate['priceTable']['currency'] = $rate['price']['currency'];
        $rate['priceTable']['priceGross'] = $rate['price_vat']['value'];
        unset($rate['price'], $rate['price_vat']);
        return $rate;
    }
}