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

namespace Kufer\Web\Classes\Datamodul;

class RaumBestuhlung extends \Datamodul
{
  
  public $rid;

  
  public $bid;

  
  public $standard;

  
  public $plaetze;

  
  public $tische;

  
  public $bemerkung;

  public function getDatamodulName(): string
  {
    return 'raumbestuhlung';
  }

  public function getTyp($pFieldName)
  {
    switch ($pFieldName) {
      default: return parent::getTyp($pFieldName);
      case 'id':
      case 'rid':
      case 'bid':
      case 'plaetze':
      case 'tische':
        return \DatamodulVarType::TYPE_INT;
      case 'standard':
        return \DatamodulVarType::TYPE_BOOL_WF;
    }
  }

  public function isValid(): bool
  {
    return !is_null($this->rid) && !is_null($this->bid);
  }

  public function getHLBestuhlung(): ?\HLBestuhlung
  {
    if (!$this->isValid()) {
      return null;
    }

    return \DBWorkHLBestuhlung::getDefaultInstance()->getOneOrNull($this->bid);
  }
}