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

namespace Kufer\Web\KuferTools\Basis\Kursdetails\Detailsreiter\Termine\TerminStornierenDialog;

use Kufer\Web\KuferTools\Basis\Kursdetails\Detailsreiter\Termine\TerminDialog;

abstract class TerminStornierenAbsendenEMailUseCase extends TerminDialog\TerminAbsendenEMailUseCase
{
  public function __construct($request, $response = null)
  {
    parent::__construct($request, $response ?? new TerminStornierenAbsendenEMailResponse());
  }

  
  protected function getKursTeilnehmerBelegungsIds(string $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;
  }
}