packages feed

keiro-dsl-0.10.0.0: test/conformance-newsurface/Generated/TransferRouting/Hospital/EventStream.hs

-- @generated by keiro-dsl 0.9.0.0 (language keiro-dsl 4) from aggregate Hospital; do not edit.
module Generated.TransferRouting.Hospital.EventStream
  ( hospitalCategory
  , hospitalCommandCategory
  , hospitalEventStream
  , hospitalEventStreamDef
  , HospitalEventStream
  , HospitalEventStreamDef
  ) where

import Generated.TransferRouting.Hospital.Domain
import Generated.TransferRouting.Hospital.Codec (hospitalCodec)
import Generated.TransferRouting.Hospital.Transducer (hospitalFoldFingerprint, hospitalTransducer)
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.
hospitalCategory :: Stream.StreamCategory HospitalEventStreamDef
hospitalCategory = Stream.categoryUnsafe "hospital"

-- The same category text, typed for command envelopes such as PMCommand.
hospitalCommandCategory :: Stream.StreamCategory HospitalCommand
hospitalCommandCategory = Stream.categoryUnsafe "hospital"

type HospitalEventStreamDef =
  EventStream (HsPred HospitalRegs HospitalCommand) HospitalRegs HospitalVertex HospitalCommand HospitalEvent

type HospitalEventStream =
  ValidatedEventStream (HsPred HospitalRegs HospitalCommand) HospitalRegs HospitalVertex HospitalCommand HospitalEvent

hospitalEventStreamDef :: HospitalEventStreamDef
hospitalEventStreamDef =
  EventStream
    { transducer = hospitalTransducer,
      initialState = HospitalAccepting,
      initialRegisters = initialHospitalRegs,
      eventCodec = hospitalCodec,
      resolveStreamName = Stream.streamName,
      snapshotPolicy = Never,
      stateCodec = Nothing
    }

hospitalEventStream :: HospitalEventStream
hospitalEventStream =
  mkEventStreamOrThrow "Hospital" hospitalEventStreamDef