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


namespace Kufer\Web\KuferTools\Mitarbeiter\KursUebersicht\Detailsreiter\Honorar\DozentenHonorar;

use Kufer\Web\KuferTools\Utils\DozKursHandler\DozKursUpdater;




class DozHonorarAbsendenUseCase extends \Kufer\Web\KuferTools\Mitarbeiter\KursUebersicht\Tool8UseCase
{
  public function __construct($request)
  {
    parent::__construct($request, new DozHonorarAbsendenResponse());
  }

  public static function getToolSectionId()
  {
    return 29; 
  }

  public function hasAccess($pToolSectionId = null)
  {
    if (!parent::hasAccess()) {
      
      return false;
    }
    
    elseif (!$this->request->isXsrfOk && !$this->request->isRefresh) {
      return false;
    }
    
    
    
    
    
    return true;
  }

  public function action()
  {
    
    $statusMessageContainer = null;

    
    $dozKursUpdateHandler = new DozKursUpdater($this->request, 'Honorar');

    
    if (!$this->request->isRefresh) {
      $dozKursUpdateHandler->doUpdate($this->request->dozHonId);
      $statusMessageContainer = $dozKursUpdateHandler->getStatusMessageContainer();
    }

    return $this->getResponse($statusMessageContainer);
  }

  protected function getResponse($pStatusMessageContainer)
  {
    $this->handleResponseStrategies();
    
    $this->response->statusMessageContainer = $pStatusMessageContainer;
    $this->response->dozHonId = $this->request->dozHonId;
    $this->response->knr = $this->request->knr;

    return $this->response;
  }

  protected function getResponseStrategies()
  {
    return array();
  }
} 

class DozHonorarAbsendenRequest
{
  public $isRefresh;
  public $isXsrfOk;
  public $dozHonId;
  public $knr;
  
  public $dozHonObj;
}

class DozHonorarAbsendenResponse extends \Kufer\Web\KuferTools\Basis\UseCase\ToolResponse
{
  public $statusMessageContainer;
  public $dozHonId;
  public $knr;
}