<?php
namespace PortalPeople\DisabledDates\Model\ResourceModel\DisabledDate\Grid;

use Magento\Framework\Api\Search\SearchResultInterface;
use Magento\Framework\Api\SearchCriteriaInterface;
use PortalPeople\DisabledDates\Model\ResourceModel\DisabledDate\Collection as DisabledDateCollection;

class Collection extends DisabledDateCollection implements SearchResultInterface
{
    protected $aggregations;

    public function __construct(
        \Magento\Framework\Data\Collection\EntityFactoryInterface $entityFactory,
        \Psr\Log\LoggerInterface $logger,
        \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy,
        \Magento\Framework\Event\ManagerInterface $eventManager,
        \Magento\Framework\DB\Adapter\AdapterInterface $connection = null,
        \Magento\Framework\Model\ResourceModel\Db\AbstractDb $resource = null
    ) {
        parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource);

        // Set values that previously were required constructor args
        $this->_eventPrefix = 'portalpeople_disabled_dates_grid';
        $this->_eventObject = 'portalpeople_disabled_dates_grid';

        // Initialize document model and resource model for UI grid consumption
        $this->_init(
            \Magento\Framework\View\Element\UiComponent\DataProvider\Document::class,
            \PortalPeople\DisabledDates\Model\ResourceModel\DisabledDate::class
        );

        // Ensure main table is set to the module table
        $this->setMainTable('portalpeople_disabled_dates');
    }

    public function getAggregations()
    {
        return $this->aggregations;
    }

    public function setAggregations($aggregations)
    {
        $this->aggregations = $aggregations;
        return $this;
    }

    public function getAllIds($limit = null, $offset = null)
    {
        return $this->getConnection()->fetchCol($this->_getAllIdsSelect($limit, $offset), $this->_bindParams);
    }

    public function getSearchCriteria()
    {
        return null;
    }

    public function setSearchCriteria(SearchCriteriaInterface $searchCriteria = null)
    {
        return $this;
    }

    public function getTotalCount()
    {
        return $this->getSize();
    }

    public function setTotalCount($totalCount)
    {
        return $this;
    }

    public function setItems(array $items = null)
    {
        return $this;
    }
}
