packages feed

keiro-dsl-0.17.0.0: test/conformance-process-timers/Generated/ProcessTimers/Incident/EventStream.hs

-- @generated by keiro-dsl 0.17.0.0 (language keiro-dsl 6) from aggregate Incident; do not edit.
module Generated.ProcessTimers.Incident.EventStream
  ( incidentCategory
  , incidentCommandCategory
  , incidentEventStream
  , incidentEventStreamDef
  , IncidentEventStream
  , IncidentEventStreamDef
  ) where

import Generated.ProcessTimers.Incident.Domain
import Generated.ProcessTimers.Incident.Codec (incidentCodec)
import Generated.ProcessTimers.Incident.Transducer (incidentTransducer)
import Keiki.Core (HsPred)
import Keiro.EventStream (EventStream (..), SnapshotPolicy (..))
import Keiro.EventStream.Validate (ValidatedEventStream, mkEventStreamOrThrow)
import Keiro.Stream qualified as Stream

-- The validated aggregate stream category (hole-kind 5: referenced, never retyped).
-- Entity streams are '<category>-<id>' via Keiro.Stream.entityStream.
-- categoryUnsafe is safe here because this generated literal passed the DSL category proof.
incidentCategory :: Stream.StreamCategory IncidentEventStreamDef
incidentCategory = Stream.categoryUnsafe "incident"

-- The same category text, typed for command envelopes such as PMCommand.
incidentCommandCategory :: Stream.StreamCategory IncidentCommand
incidentCommandCategory = Stream.categoryUnsafe "incident"

type IncidentEventStreamDef =
  EventStream (HsPred IncidentRegs IncidentCommand) IncidentRegs IncidentVertex IncidentCommand IncidentEvent

type IncidentEventStream =
  ValidatedEventStream (HsPred IncidentRegs IncidentCommand) IncidentRegs IncidentVertex IncidentCommand IncidentEvent

incidentEventStreamDef :: IncidentEventStreamDef
incidentEventStreamDef =
  EventStream
    { transducer = incidentTransducer,
      initialState = IncidentOpen,
      initialRegisters = initialIncidentRegs,
      eventCodec = incidentCodec,
      resolveStreamName = Stream.streamName,
      snapshotPolicy = Never,
      stateCodec = Nothing
    }

incidentEventStream :: IncidentEventStream
incidentEventStream =
  mkEventStreamOrThrow "Incident" incidentEventStreamDef