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

declare(strict_types = 1);

namespace Kufer\Web\Classes\Dbfilter\RegisteredCall;

use Kufer\Web\Classes\Dbfilter\AbstractSQLFilter;
use Kufer\Web\Classes\Dbfilter\SQLFilterUtils;

class RegisteredDBCallGuid extends RegisteredDBCall
{
  public function getType(): int
  {
    return \Kufer\Web\Classes\Dbfilter\AbstractSQLFilter::TYPE_GUID;
  }

  public function getCapabilities(): int
  {
    return static::SUPPORTS_EQUALS
      | static::SUPPORTS_EQUALS_DEFAULT
      | static::SUPPORTS_IN
      | static::SUPPORTS_IN_DEFAULT;
  }

  public function like(AbstractSQLFilter $filter, $value): callable
  {
    throw new CallNotSupportedException('Abfrage like hier nicht unterstützt.');
  }

  public function contains(AbstractSQLFilter $filter, $value): callable
  {
    throw new CallNotSupportedException('Abfrage contains hier nicht unterstützt.');
  }

  public function is(AbstractSQLFilter $filter): callable
  {
    throw new CallNotSupportedException('Abfrage is hier nicht unterstützt.');
  }

  public function isDefault(AbstractSQLFilter $filter, $default): callable
  {
    throw new CallNotSupportedException('Abfrage is hier nicht unterstützt.');
  }

  public function equals(AbstractSQLFilter $filter, $value): callable
  {
    return $this->equalsDefault($filter, $value, $this->default);
  }

  public function equalsDefault(AbstractSQLFilter $filter, $value, $default): callable
  {
    return SQLFilterUtils::filterGuid($this->table, $this->column, $value, $default);
  }

  public function in(AbstractSQLFilter $filter, iterable $value): callable
  {
    return $this->inDefault($filter, $value, $this->default);
  }

  public function inDefault(AbstractSQLFilter $filter, iterable $value, $default): callable
  {
    return SQLFilterUtils::filterInGuid($this->table, $this->column, $value, $default);
  }

  public function less(AbstractSQLFilter $filter, $value): callable
  {
    throw new CallNotSupportedException('Abfrage less hier nicht unterstützt.');
  }

  public function greater(AbstractSQLFilter $filter, $value): callable
  {
    throw new CallNotSupportedException('Abfrage greater hier nicht unterstützt.');
  }

  public function lessDefault(AbstractSQLFilter $filter, $value, $default): callable
  {
    throw new CallNotSupportedException('Abfrage less hier nicht unterstützt.');
  }

  public function greaterDefault(AbstractSQLFilter $filter, $value, $default): callable
  {
    throw new CallNotSupportedException('Abfrage greater hier nicht unterstützt.');
  }
}