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

namespace Kufer\Web\Classes\Dbfilter;


class AktuellesFreigabeSQLFilter extends BasicSQLFilter
{
  protected function __construct()
  {
    parent::__construct();

    $this->registerDb('Id', 'id', static::TYPE_INTEGER);
    $this->registerDb('AktuellesId', 'id', static::TYPE_INTEGER);
    $this->registerDb('PersonType', 'person_typ', static::TYPE_STRING);
    $this->registerDb('PersonId', 'person_id, person_guid', static::TYPE_IDENTIFIER);
    $this->registerDb('Write', 'schreiben', static::TYPE_BOOLEAN_W_F);
    $this->registerDb('CreatedAt', 'erstelltam', static::TYPE_DATETIME);
  }

  public function getTablePraeffix(): string
  {
    return 'web_akt_freigabe';
  }

  public function equalsId($id): IFilter
  {
    $this->applyFilterCurrent(
      static::FILTER_OPTION_ID,
      SQLFilterUtils::filterEqualsIdInt('id', $id)
    );

    return $this;
  }

  public function inId(iterable $ids): IFilter
  {
    $this->applyFilterCurrent(
      static::FILTER_OPTION_ID,
      SQLFilterUtils::filterInIdInt('id', $ids)
    );

    return $this;
  }
}