@startuml
package "core:sessions" {
  enum SessionStatus {
    CREATED
    ACTIVE
    PAUSED
    COMPLETED
    FAILED
  }

  data class SessionState {
    + status: SessionStatus
    + createdAt: Instant?
    + updatedAt: Instant?
  }

  data class Session {
    + sessionId: SessionId
    + state: SessionState
  }

  interface SessionReducer {
    + reduce(SessionState, StoredEvent): SessionState
  }

  class DefaultSessionReducer

  class SessionProjector

  class DefaultSessionRepository {
    + getSession(SessionId): Session
  }

  sealed interface TransitionResult {
    data class Applied
    data object Rejected
  }

  enum ApprovalMode {
    DENY
    PROMPT
    AUTO
    YOLO
  }

  DefaultSessionReducer ..|> SessionReducer
  SessionProjector --> SessionReducer
  SessionProjector ..|> Projection

  DefaultSessionRepository --> EventReplayer
  DefaultSessionRepository ..> Session : creates
  Session *-- SessionState
}

package ":core:events" as EVENTS {
  interface Projection
  interface EventReplayer
  interface EventStore
  enum SessionStatus as SES
}

DefaultSessionRepository --> EVENTS
SessionProjector --> EVENTS

@enduml
