<?php
/**
 * @copyright (c) Kufer Software GmbH, Loisachstrasse 4, D-84453 Mühldorf
 */

class Kind extends Personn
{
  public $knr;
  public $tnr;
  public $anm_lfdnr;
  public $ausschluss;
  public $text;

  public function hasKennzeichen($pKennz = '')
  {
    return false;
  }

  public function hasAttachments()
  {
    return false;
  }

  public function hasBranchen()
  {
    return false;
  }

  public function getDMZValue($fieldname)
  {
    if ($fieldname == 'text') {
      return $this->getVarValue('info');
    }

    return parent::getDMZValue($fieldname);
  }

  public function getTyp($pFieldName)
  {
    switch ($pFieldName) {
      default:
        return parent::getTyp($pFieldName);
      case 'tnr':
      case 'anm_lfdnr':
        return \DatamodulVarType::TYPE_INT;
    }
  }

  public function getEMailName(): string
  {
    return $this->getVarValue('name_vorname_ohne_komma');
  }

  public function getEMailAddress(): ?string
  {
    $dbwTeilnehmer = new \DBWorkTeilnehmer(1, true);

    return $dbwTeilnehmer->getTeilnehm($this->tnr)->getEMailAddress();
  }
}