<?php

namespace Paysera\DeliveryApi\MerchantClient\Entity;

use Paysera\Scoped\Paysera\Component\RestClientCommon\Entity\Entity;
class OrderConfirmationErrorCollection extends Entity
{
    public function __construct(array $data = [])
    {
        parent::__construct($data);
    }
    /**
     * @return OrderConfirmationError[]
     */
    public function getItems()
    {
        $items = $this->getByReference('items');
        if ($items === null) {
            return [];
        }
        $list = [];
        foreach ($items as &$item) {
            $list[] = (new \Paysera\DeliveryApi\MerchantClient\Entity\OrderConfirmationError())->setDataByReference($item);
        }
        return $list;
    }
    /**
     * @param OrderConfirmationError[] $items
     * @return $this
     */
    public function setItems(array $items)
    {
        $data = [];
        foreach ($items as $item) {
            $data[] = $item->getDataByReference();
        }
        $this->setByReference('items', $data);
        return $this;
    }
}
