<?php

declare (strict_types=1);
namespace CelerSearch\Vendor\Meilisearch\Contracts;

/** @internal */
class IndexesQuery
{
    /**
     * @var non-negative-int|null
     */
    private ?int $offset = null;
    /**
     * @var non-negative-int|null
     */
    private ?int $limit = null;
    /**
     * @param non-negative-int $offset
     *
     * @return $this
     */
    public function setOffset(int $offset) : self
    {
        $this->offset = $offset;
        return $this;
    }
    /**
     * @param non-negative-int $limit
     *
     * @return $this
     */
    public function setLimit(int $limit) : self
    {
        $this->limit = $limit;
        return $this;
    }
    /**
     * @return array{
     *     offset?: non-negative-int,
     *     limit?: non-negative-int
     * }
     */
    public function toArray() : array
    {
        return \array_filter(['offset' => $this->offset, 'limit' => $this->limit], static function ($item) {
            return null !== $item;
        });
    }
}
