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

namespace Kufer\Web\Classes\Dbfilter;


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

    $this->registerDb('Id', 'id', static::TYPE_INTEGER);
    $this->registerDb('RaumId', 'rid', static::TYPE_INTEGER);
    $this->registerDb('HLBestuhlungId', 'bid', static::TYPE_INTEGER);
    $this->registerDb('Standard', 'standard', static::TYPE_BOOLEAN_W_F);
    $this->registerDb('Plaetze', 'plaetze', static::TYPE_INTEGER);
    $this->registerDb('Tische', 'tische', static::TYPE_INTEGER);
    $this->registerDb('Bemerkung', 'bemerkung', static::TYPE_STRING);
  }

  public function isValid(): RaumBestuhlungenSQLFilter
  {
    $this->notAny(static function(RaumBestuhlungenSQLFilter $filter): void {
      $filter->equalsRaumId(null);
      $filter->equalsHLBestuhlungId(null);
    });

    return $this;
  }

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

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

    return $this;
  }
}