*/ abstract public static function caseTypes(): array; /** @return list */ abstract public static function intakes(): array; abstract public static function responsibilities(): Responsibilities; /** @return list */ abstract public function steps(): array; /** * Settings the model fixes for its cases (e.g. the pre-reservation of the offer model). * * @return array */ public static function fixes(): array { return []; } /** * @return list */ public function variants(): array { return [Variant::make('standard', 'Standard')]; } public function variant(string $key): ?Variant { foreach ($this->variants() as $variant) { if ($variant->key === $key) { return $variant; } } return null; } /** * The modules of the course in order, with the variant's modules at their points. * * @return list */ public function modules(?string $variant = 'standard'): array { $chosen = $this->variant($variant ?? 'standard'); $modules = []; foreach ($this->steps() as $step) { if ($step->isPoint()) { array_push($modules, ...($chosen?->modulesAt($step->point) ?? [])); } else { $modules[] = $step->module; } } return $modules; } /** * @return list */ public function points(): array { return array_values(array_map(fn (Step $step): Point => $step->point, array_filter($this->steps(), fn (Step $step): bool => $step->isPoint()))); } public static function reference(): string { return static::key().'@'.static::version(); } /** Whether the model fixes the setting (the configurator shows it, but not as a choice). */ public static function fixesSetting(ProcessSetting $setting): bool { return array_key_exists($setting->value, static::fixes()); } }