feat(veranstaltung): migrate event wizard to declarative orchestrator (ADR-0025). Transferred logic from EventFlowSample to EventWizardFlow. Renamed Demo* components to EventWizard*. Added OETO-compliant steps: TurnierKonfiguration, BewerbKonfiguration, AbteilungKonfiguration, Summary. Updated DSL flow to include full sequential path. --trailer "Co-authored-by: Junie <junie@jetbrains.com>"

This commit is contained in:
2026-04-28 13:24:27 +02:00
parent d493734660
commit 5d6d9efd27
15 changed files with 389 additions and 8 deletions
@@ -1,7 +1,76 @@
package at.mocode.veranstaltung.feature.wizard
// Platzhalter für den Event-Flow.
// Hinweis: Der echte Flow lebt zunächst als Demo in :frontend:core:wizard (samples),
// bis die VM-Delegation hinter dem Feature-Flag integriert wird.
import at.mocode.frontend.core.navigation.AppScreen
import at.mocode.frontend.core.wizard.dsl.flow
import at.mocode.frontend.core.wizard.runtime.Guard
import at.mocode.frontend.core.wizard.runtime.StepId
import at.mocode.frontend.core.wizard.runtime.WizardContext
import at.mocode.frontend.core.wizard.runtime.WizardState
object EventWizardPlaceholder
sealed interface EventWizardStep : StepId {
data object ZnsCheck : EventWizardStep
data object VeranstalterSelection : EventWizardStep
data object AnsprechpersonMapping : EventWizardStep
data object MetaData : EventWizardStep
data object TurnierKonfiguration : EventWizardStep
data object BewerbKonfiguration : EventWizardStep
data object AbteilungKonfiguration : EventWizardStep
data object Summary : EventWizardStep
}
data class EventWizardAcc(
val veranstalterId: String? = null,
val veranstalterNr: String = ""
)
object EventWizardGuards {
val hasZns: Guard<EventWizardStep, EventWizardAcc> = { ctx, _ ->
val stats = ctx.stats
if (stats == null) false
else {
val hasData = stats.vereinCount > 0
hasData && !stats.lastImport.isNullOrBlank()
}
}
val needsContactPerson: Guard<EventWizardStep, EventWizardAcc> = { _, acc ->
acc.veranstalterId == null || acc.veranstalterNr.startsWith("ORG-")
}
val hasSelectedVeranstalter: Guard<EventWizardStep, EventWizardAcc> = { _, acc ->
!acc.veranstalterId.isNullOrBlank()
}
}
val EventWizardFlow = flow<EventWizardStep, EventWizardAcc>(start = EventWizardStep.ZnsCheck) {
step(EventWizardStep.ZnsCheck) {
whenGuard("hasZns", EventWizardGuards.hasZns, go = EventWizardStep.VeranstalterSelection)
otherwise(EventWizardStep.VeranstalterSelection)
}
step(EventWizardStep.VeranstalterSelection) {
whenGuard("notSelected", { ctx, acc -> !EventWizardGuards.hasSelectedVeranstalter(ctx, acc) }, go = EventWizardStep.VeranstalterSelection)
whenGuard("needsContactPerson", EventWizardGuards.needsContactPerson, go = EventWizardStep.AnsprechpersonMapping)
otherwise(EventWizardStep.MetaData)
}
step(EventWizardStep.AnsprechpersonMapping) {
otherwise(EventWizardStep.MetaData)
}
step(EventWizardStep.MetaData) {
otherwise(EventWizardStep.TurnierKonfiguration)
}
step(EventWizardStep.TurnierKonfiguration) {
otherwise(EventWizardStep.BewerbKonfiguration)
}
step(EventWizardStep.BewerbKonfiguration) {
otherwise(EventWizardStep.AbteilungKonfiguration)
}
step(EventWizardStep.AbteilungKonfiguration) {
otherwise(EventWizardStep.Summary)
}
step(EventWizardStep.Summary) {
// End-Step
}
}
fun eventWizardStartState(origin: AppScreen, acc: EventWizardAcc = EventWizardAcc()): WizardState<EventWizardStep, EventWizardAcc> =
WizardState(current = EventWizardStep.ZnsCheck, acc = acc)