<?php

namespace KupShop\GraphQLBundle\ApiPos\Types\Collection;

use KupShop\GraphQLBundle\ApiPos\Types\Payments\PosPayment;
use KupShop\GraphQLBundle\ApiShared\Types\Collection\CollectionBase;
use TheCodingMachine\GraphQLite\Annotations\Field;
use TheCodingMachine\GraphQLite\Annotations\Type;

/**
 * @Type()
 */
class PosPaymentCollection extends CollectionBase
{
    private $totalCash;
    private $actualPage;

    public function __construct(array $items, $totalCash, $actualPage, $previousPage, $nextPage)
    {
        parent::__construct($items);
        $this->totalCash = $totalCash;
        $this->actualPage = $actualPage;
        $this->hasPreviousPage = $previousPage;
        $this->hasNextPage = $nextPage;
    }

    /**
     * @Field()
     *
     * @return PosPayment[]
     */
    public function getItems(): array
    {
        return $this->items;
    }

    /**
     * @Field()
     */
    public function getTotalCash(): string
    {
        return $this->totalCash ?? '0';
    }

    /**
     * @Field()
     */
    public function getActualPage(): string
    {
        return strval($this->actualPage);
    }

    /**
     * @Field()
     */
    public function getHasNextPage(): bool
    {
        return $this->hasNextPage;
    }

    /**
     * @Field()
     */
    public function getHasPreviousPage(): bool
    {
        return $this->hasPreviousPage;
    }
}
