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

namespace Kufer\KuferTools\Basis\Kursdetails\DetailsReiter\Termine\TerminStornierenDialog;

abstract class TerminStornierenAbsendenEMailUseCase extends \Kufer\KuferTools\Basis\Kursdetails\DetailsReiter\Termine\TerminDialog\TerminAbsendenEMailUseCase
{
  
  public function __construct($request, $response = null)
  {
    parent::__construct($request, $response ?? new TerminStornierenAbsendenEMailRequest());
  }

  
  protected function getKursTeilnehmerBelegungsIds($knr): array
  {
    $dbwBelegungen = new \DBWorkBelegung();

    return $dbwBelegungen->getBelegungenIdsbyKursNR($knr);
  }

  public function getResponseForEMail()
  {
    parent::getResponseForEMail();
    $this->response->knr = $this->request->knr;
    $this->response->kurstag = $this->request->kurstag;
    $this->response->oldKurstag = $this->request->oldKurstag;
    $this->response->fristErreicht = $this->request->fristErreicht;

    return $this->response;
  }

  protected function getDozenten(): array
  {
    $dozenten = array();
    $dozenten[$this->request->kurstag->dozent->id] = $this->request->kurstag->dozent;
    $dozenten[$this->request->oldKurstag->dozent->id] = $this->request->oldKurstag->dozent;

    return $dozenten;
  }
}

class TerminStornierenAbsendenEMailRequest extends \Kufer\KuferTools\Basis\Kursdetails\DetailsReiter\Termine\TerminDialog\TerminAbsendenEMailRequest
{
  
  public $oldKurstag;

  
  public $fristErreicht;
}

class TerminStornierenAbsendenEMailResponse extends \Kufer\KuferTools\Basis\Kursdetails\DetailsReiter\Termine\TerminDialog\TerminAbsendenEMailResponse
{
  
  public $oldKurstag;

  
  public $successMessage;
}