*/ 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; /** * What a channel must be able to do (and not do) for this model to fit: capability key => required value. Empty: * the model fits every channel that delivers its intake kind (docs/Prozessarchitektur/V2.1/02 §3.2). * * @return array */ public static function capabilityRequirements(): array { return []; } /** * 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 function template areas this model offers a slot for (empty: the model's course is fixed). * * @return list */ public function slots(): array { return array_values(array_map(fn (Step $step): TemplateArea => $step->slot, array_filter($this->steps(), fn (Step $step): bool => $step->isSlot()))); } /** * The results the base course provides to the templates of its slots (see FunctionTemplate::requires()). * * @return list */ public static function providedResults(): array { return []; } /** * The template (key) every slot gets when none was chosen: area value => template key. * * @return array */ public static function defaultTemplates(): array { return []; } /** * Whether the model is kept for compatibility (existing channels and frozen plans) and no longer offered as a * choice: its combination is a preset of a composable model. */ public static function isLegacy(): bool { return false; } /** * The template combination that reproduces this legacy model (area value => template key), or empty. * * @return array */ public static function presetTemplates(): array { return []; } /** * The modules of the course in order, with the variant's modules at their points and the chosen templates' modules * at their slots. * * @param array $templates area value => template key or key@version (missing areas: the default) * @return list */ public function modules(?string $variant = 'standard', array $templates = []): array { $chosen = $this->variant($variant ?? 'standard'); $catalogue = app(ProcessCatalogue::class); $modules = []; foreach ($this->steps() as $step) { if ($step->isPoint()) { array_push($modules, ...($chosen?->modulesAt($step->point) ?? [])); } elseif ($step->isSlot()) { $reference = $templates[$step->slot->value] ?? static::defaultTemplates()[$step->slot->value] ?? null; if ($reference !== null && ($class = $catalogue->templateClass($reference)) !== null) { array_push($modules, ...$class::modules()); } } 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()); } }