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

namespace Kufer\Web\KuferTools\Veranstalter\Anmeldung\NachlassDialog;

class NachlassDialogUseCase extends \Kufer\Web\KuferTools\Basis\NachlassDialog\NachlassDialogAnmeldungUseCase
{
  public static function getToolSectionId()
  {
    return 634;
  }

  public static function getToolId()
  {
    return \ToolsAPI::TOOL_ANMELDUNGBUCHEN_VA;
  }

  protected function getFormularAction()
  {
    $xsrf = new \Xsrf();
    $xsrfKey = $xsrf->generateKey4Action('handleAnmeldung', $this->request->knr);
    
    return 'index.php?tool_id=' . self::getToolId() . '&action=handleAnmeldung&knr='
                  . $this->request->knr . '&xsrf=' . $xsrfKey;
  }

  private function isFormReadonly()
  {
    return \SessionOperations::getVarValueWTIntern('AnmeldungReadonly_' . $this->getToolId()) == 1;
  }

  protected function getResponse()
  {
    $response = parent::getResponse();
    $response->disabled = $this->isFormReadonly();

    return $response;
  }
}