<?php
/**
 * @copyright (c) Kufer Software GmbH, Oderstraße 7, D-84453 Mühldorf
 */

namespace Kufer\Web\Classes\Dbfilter;


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

    $this->registerDb('Id', 'id', static::TYPE_INTEGER);
    $this->registerDb('AddressId', 'adrnr', static::TYPE_INTEGER);
    $this->registerDb('Type', 'typ', static::TYPE_STRING);
    $this->registerDb('Vorname', 'vorname', static::TYPE_STRING);
    $this->registerDb('Nachname', 'name', static::TYPE_STRING);
  }

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

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

    return $this;
  }
}