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

namespace Kufer\KuferTools\Mitarbeiter\Anmeldung\HandleSaveSettingsAjax;

class HandleSaveSettingsAjaxUseCase extends \Kufer\KuferTools\Basis\UseCase\ToolUseCase
{
  public function __construct($request)
  {
    parent::__construct($request, new HandleSaveSettingsAjaxResponse());
  }

  public static function getToolSectionId()
  {
    return 434;
  }

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

  public function action()
  {
    $settingsSaved = false;
    if ($this->request->savesettings) {
      
      
      \SessionOperations::setVarValueWTIntern('choosedOptions', $this->request->ausgewaehlteOptionen);
      $settingsSaved = true;
    }

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

  protected function getResponse($settingsSaved)
  {
    $this->response->settingsSaved = $settingsSaved;

    return $this->response;
  }
}

class HandleSaveSettingsAjaxRequest
{
  public $savesettings;
  public $ausgewaehlteOptionen;
}

class HandleSaveSettingsAjaxResponse extends \Kufer\KuferTools\Basis\UseCase\ToolResponse
{
  public $settingsSaved;
}