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

namespace Kufer\KuferTools\Teilnehmer\Visitenkarten\VisitenkartenUebersicht\NeueVisitenkarteErstellen;

class NeueVisitenkarteErstellenUseCase extends \Kufer\KuferTools\Basis\UseCase\ToolUseCase
{
  
  public function __construct($request)
  {
    parent::__construct($request, new NeueVisitenkarteErstellenResponse());
    
  }
    
  public static function getToolSectionId()
  {
    return 496;
  }
  
  public static function getToolId()
  {
    return TOOL_WEBVISITENKARTEN;
  }
  
  public function action()
  {  
    return $this->getResponse();
  }
  
  protected function getResponse()
  {
    $this->handleResponseStrategies();
    $this->response->ueberschrift = $this->getUeberschrift();
    $buttonleiste = new \Kufer\KuferTools\Basis\Button\Buttonleiste();
    $this->response->buttons = $buttonleiste->getHtmlButtonleiste($this->getButtons());
    $this->response->statusCode = $this->request->statusCode;
    $this->response->visitenkarte = $this->getVisitenkarte();
    
    return $this->response; 
  }
  
  protected function getResponseStrategies()
  {
    return array(
        new \Kufer\KuferTools\Utils\ResponseStrategies\ResponseMitRahmen($this),
        new \Kufer\KuferTools\Utils\ResponseStrategies\ResponseWss($this)
    );
  }
  
  protected function getUeberschrift() {
    return 'Neue Visitenkarte anlegen';
  }
  
  protected function getButtons()
  {
    $buttons = array();
    $buttonFactory = new \Kufer\KuferTools\Basis\Button\ButtonFactory();
    $buttons[] =array ($buttonFactory->getAutomatischAusfuellenVisitenkartenButton());
    $buttons[] = array($buttonFactory->getErstellteVisitenkarteAbsendenButton());
    $buttons[] =array ($buttonFactory->getZurueckZurVisitenkartenUebersichtButton($this->getToolId()));
          
    return $buttons;
  }
  
  private function getDbwVisitenkartenWeb()
  {
    return \DBWorkVisitenkartenWeb::getDefaultInstance(1, true);
  }
  
  protected function getVisitenkarte()
  {
    $dbWorkVisitenkartenWeb = $this->getDbwVisitenkartenWeb();
    $visitenkarte = $dbWorkVisitenkartenWeb->getNewObject();
    
    return $visitenkarte;
  }

}

class NeueVisitenkarteErstellenRequest
{
 public $statusCode;
 public $visitenkarteId;
}

class NeueVisitenkarteErstellenResponse
{
  public $ueberschrift;
  public $visitenkarte;
  public $columns;
  public $buttons;
  public $statusCode;
}