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

class ComboboxBezirk extends Combobox
{
  protected function getDatamodulAry(): array
  {
    $db = new DBWorkHLGemeinde(1, true);
    $bezirke = $db->getBezirke();

    return $db->wandleBezirkeInDatamoduleUm($bezirke);
  }

  protected function getValueFieldName(): string
  {
    return 'bezirk';
  }

  protected function getTextFieldName(): string
  {
    return 'bezirk';
  }

  protected function getDefaultOption(): ?\ComboboxOption
  {
    $option = new ComboboxOption();
    $option->value = '';
    $option->text = '--Bezirk auswählen--';
    $option->isSelected = is_null($this->selectedValue);

    return $option;
  }
}