package com.correx.core.events.events

import com.correx.core.events.types.SessionId
import com.correx.core.events.types.StageId
import com.correx.core.events.types.TransitionId
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
@SerialName("StageCompleted")
data class StageCompletedEvent(
    val sessionId: SessionId,
    val stageId: StageId,
    val transitionId: TransitionId
) : EventPayload

@Serializable
@SerialName("StageFailed")
data class StageFailedEvent(
    val sessionId: SessionId,
    val stageId: StageId,
    val transitionId: TransitionId,
    val reason: String
) : EventPayload

@Serializable
@SerialName("TransitionExecuted")
data class TransitionExecutedEvent(
    val sessionId: SessionId,
    val from: StageId,
    val to: StageId,
    val transitionId: TransitionId,
    // Set when this transition was produced by a preemptive redirect override (freestyle
    // graph re-routing). Carries the originating PreemptRedirectEvent.redirectId — this is the
    // durable "redirect consumed" marker the override reads to apply each redirect exactly once.
    val redirectId: String? = null,
) : EventPayload
