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

namespace Kufer\Web\KuferTools\Utils\FilterSettings\Kurstage;

use Kufer\Web\Classes\Dbfilter\IFilter;
use Kufer\Web\KuferTools\Utils\FilterSettings\FilterSettingsCompositor;
use Kufer\Web\KuferTools\Utils\FilterSettings\IFilterSettings;

class KurstageFilterSettingsHelper
{
  private function __construct()
  {
  }

  public static function createBasicFilterSettings(): IFilterSettings
  {
    return new FilterSettingsCompositor(); 
  }

  
  public static function createKurseFilterSettings(array $semester, bool $justNoAusfall, bool $justNoAbschluss, bool $noHauptkurse): IFilterSettings
  {
    return new FilterSettingsCompositor(
      new KurseFilterSettings($semester, $justNoAusfall, $justNoAbschluss, $noHauptkurse)
    );
  }

  public static function createDozentenLehrplanFilterSettings(\ToolSettingsBASys $toolSettings): IFilterSettings
  {
    return new FilterSettingsCompositor(
      static::createBasicFilterSettings(),
      static::createKurseFilterSettings(
        explode(',', $toolSettings->semlist),
        $toolSettings->keineAusgefallenenKurse ?? false,
        $toolSettings->keineAbgeschlossenenKurse ?? false,
        $toolSettings->keineHauptkurse ?? false
      ),
      new DozententoolFilterSettings()
    );
  }
}