<?php
/**
 * @copyright (c) Kufer Software GmbH, Loisachstrasse 4, D-84453 Mühldorf
 */

namespace Kufer\Web\KuferTools\Utils\FilterSettings\Aktuelles;

use Kufer\Web\Classes\Dbfilter\AktuellesWTSQLFilter;
use Kufer\Web\Classes\Dbfilter\ISQLFilter;

class GueltigFilterSettings implements \Kufer\Web\KuferTools\Utils\FilterSettings\IFilterSettings
{
  
  public function applySettings($filter): ISQLFilter
  {
    $filter->any(static function(AktuellesWTSQLFilter $filter): void {
      $filter->greaterEqualsValidUntil(\DateTimeOperations::getDateNow());
      $filter->equalsValidUntil(null);
    });

    return $filter;
  }

  public function assertFilterClass($filter): void
  {
    assert($filter instanceof AktuellesWTSQLFilter);
  }
}