<?php

declare(strict_types=1);

namespace KupShop\GraphQLBundle\ApiAdmin\Types\Return;

use KupShop\GraphQLBundle\ApiShared\Types\Collection\AbstractCollection;
use TheCodingMachine\GraphQLite\Annotations\Field;
use TheCodingMachine\GraphQLite\Annotations\Type;

/**
 * @property \KupShop\ReturnsBundle\ReturnList\ReturnCollection $collection
 */
#[Type]
class ReturnCollection extends AbstractCollection
{
    /**
     * @return ReturnDto[]
     */
    #[Field]
    public function getItems(): array
    {
        $items = [];

        foreach ($this->collection as $item) {
            $items[] = new ReturnDto($item, $this->collection);
        }

        return $items;
    }
}
