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

declare(strict_types = 1);

namespace Kufer\Web\Classes\Dbfilter;


final class Dozenten2SQLFilter extends BasicSQLFilter
{
  public const FILTER_OPTION_GEMEINDE = 'gemeinde';
  public const FILTER_OPTION_STADTTEIL = 'stadtteil';
  public const FILTER_OPTION_BEZIRK = 'bezirk';
  public const FILTER_OPTION_BUNDESLAND = 'bundesland';

  protected function __construct()
  {
    parent::__construct();

    $this->registerDb('Gemeinde', 'gemeinde', static::TYPE_STRING);
    $this->registerDb('Stadtteil', 'stadtteil', static::TYPE_STRING);
    $this->registerDb('Bezirk', 'bezirk', static::TYPE_STRING);
    $this->registerDb('Bundesland', 'bundesland', static::TYPE_STRING);
  }

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

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

    return $this;
  }

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

    return $this;
  }
}