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

class ComboboxGeschlechtAnrede extends Combobox
{
  protected function getDatamodulAry(): array
  {
    $result = array();

    $herrObj = new Geschlecht();
    $herrObj->id = 1;
    $herrObj->kurz = 'H';
    $herrObj->lang = 'Herr';

    $frauObj = new Geschlecht();
    $frauObj->id = 2;
    $frauObj->kurz = 'F';
    $frauObj->lang = 'Frau';

    array_push($result, $herrObj, $frauObj);

    return $result;
  }

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

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

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

    return $option;
  }
}