<?php

namespace NoahVet\Reef\Phpunit\Iterator;

use NoahVet\Reef\Iterator\ReefApiIteratorInterface;

/**
 * @template TValue of object
 *
 * @implements ReefApiIteratorInterface<TValue, array<string, mixed>>
 */
class MockedReefApiIterator implements ReefApiIteratorInterface
{
    /**
     * @param \ArrayIterator<int, TValue> $items
     * @param array<string, mixed>        $params
     */
    public function __construct(
        private readonly \ArrayIterator $items,
        private array $params,
    ) {
    }

    #[\Override]
    public function getParams(): array
    {
        return $this->params;
    }

    #[\Override]
    public function setParams(array $params): void
    {
        $this->params = $params;
    }

    #[\Override]
    public function current(): mixed
    {
        return $this->items->current();
    }

    #[\Override]
    public function next(): void
    {
        $this->items->next();
    }

    #[\Override]
    public function key(): mixed
    {
        return $this->items->key();
    }

    #[\Override]
    public function valid(): bool
    {
        return $this->items->valid();
    }

    #[\Override]
    public function rewind(): void
    {
        $this->items->rewind();
    }
}
