packages feed

keiro-dsl-0.10.0.0: test/conformance-coldstart/Generated/Billing/Subscription/EventStream.hs

-- @generated by keiro-dsl 0.9.0.0 (language keiro-dsl 4) from aggregate Subscription; do not edit.
module Generated.Billing.Subscription.EventStream
  ( subscriptionCategory
  , subscriptionCommandCategory
  , subscriptionEventStream
  , subscriptionEventStreamDef
  , SubscriptionEventStream
  , SubscriptionEventStreamDef
  ) where

import Generated.Billing.Subscription.Domain
import Generated.Billing.Subscription.Codec (subscriptionCodec)
import Generated.Billing.Subscription.Transducer (subscriptionFoldFingerprint, subscriptionTransducer)
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.
subscriptionCategory :: Stream.StreamCategory SubscriptionEventStreamDef
subscriptionCategory = Stream.categoryUnsafe "subscription"

-- The same category text, typed for command envelopes such as PMCommand.
subscriptionCommandCategory :: Stream.StreamCategory SubscriptionCommand
subscriptionCommandCategory = Stream.categoryUnsafe "subscription"

type SubscriptionEventStreamDef =
  EventStream (HsPred SubscriptionRegs SubscriptionCommand) SubscriptionRegs SubscriptionVertex SubscriptionCommand SubscriptionEvent

type SubscriptionEventStream =
  ValidatedEventStream (HsPred SubscriptionRegs SubscriptionCommand) SubscriptionRegs SubscriptionVertex SubscriptionCommand SubscriptionEvent

subscriptionEventStreamDef :: SubscriptionEventStreamDef
subscriptionEventStreamDef =
  EventStream
    { transducer = subscriptionTransducer,
      initialState = SubscriptionInactive,
      initialRegisters = initialSubscriptionRegs,
      eventCodec = subscriptionCodec,
      resolveStreamName = Stream.streamName,
      snapshotPolicy = Never,
      stateCodec = Nothing
    }

subscriptionEventStream :: SubscriptionEventStream
subscriptionEventStream =
  mkEventStreamOrThrow "Subscription" subscriptionEventStreamDef