import type { ComponentType } from "react"; import type { GraphSpec } from "../graph/types"; import type { DomainType } from "../engine/shared/types"; export interface ParamDef

> { id: string; label: string; symbol?: string; min: number; max: number; step: number; default: number; unit?: string; marks?: { value: number; label: string }[]; description?: string; hidden?: boolean; visibleWhen?: (params: P) => boolean; } export type ParamSpec

> = ParamDef

; export interface SubCaseSpec

{ id: string; badge: string; title: string; subtitle: string; isActive: (params: P) => boolean; params: Partial

; } export interface PresetDef

> { id: string; label: string; description?: string; badge?: string; params: P; } export interface StatCardData { id: string; label: string; value: string | number; unit?: string; subtext?: string; delta?: { value: string | number; isPositiveGood?: boolean; direction?: "up" | "down" | "neutral"; }; color?: "slate" | "blue" | "emerald" | "rose" | "amber" | "purple"; } export interface CalcStepData { stepNumber: number; title: string; latexFormula?: string; explanation: string; resultText?: string; } export interface ComparisonRowData { criterion: string; baseValue: string | number; currentValue: string | number; cashValue?: string | number; note?: string; } export interface CrossBridgeLink { title: string; targetScenarioId?: string; domain: DomainType; description: string; tag?: string; } export interface ScenarioViewOutput { graph: GraphSpec; stats: StatCardData[]; steps?: CalcStepData[]; comparison?: { headers: string[]; rows: ComparisonRowData[]; }; statusBanner?: { text: string; type?: "info" | "success" | "warning" | "danger"; }; bridgeLinks?: CrossBridgeLink[]; footnote?: string; } export interface ScenarioMeta { id: string; domain: DomainType; category: string; chapter: string; title: string; subtitle?: string; source: string; notebook_id: string; tags: string[]; inputBanner?: { label: string; value: string }[]; } export interface ScenarioDef< P extends Record = Record, R = unknown, > { meta: ScenarioMeta; params: Record>; subCases?: SubCaseSpec

[]; presets?: Record>; model: (params: P) => R; view: (result: R, params: P) => ScenarioViewOutput; explain: ComponentType<{ result: R; params: P }>; } export type AnyScenarioDef = ScenarioDef, unknown>; export function defineScenario< P extends Record, R, >(def: ScenarioDef): ScenarioDef { return def; }