<?php

declare(strict_types=1);

namespace Seka\Portal\Modul\Statistiky\Repositories\Eloquent\Criteria\Zaznam;

use DateTimeInterface;
use Prettus\Repository\Contracts\CriteriaInterface;
use Prettus\Repository\Contracts\RepositoryInterface;

/**
 * Class ZaznamDatumCriteria
 *
 * @package Seka\Portal\Modul\Statistiky\Repositories\Eloquent\Criteria\Zaznam
 */
final class ZaznamDatumCriteria implements CriteriaInterface
{
    /**
     * @var \DateTimeInterface
     */
    private DateTimeInterface $datum;

    /**
     * ZaznamDatumCriteria constructor.
     *
     * @param \DateTimeInterface $datum
     */
    public function __construct(DateTimeInterface $datum)
    {
        $this->datum = $datum;
    }

    /**
     * @inheritDoc
     */
    public function apply($model, RepositoryInterface $repository)
    {
        return $model->where('datum', $this->datum);
    }
}
