packages feed

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

-- @generated by keiro-dsl; do not edit. Regenerated from the .keiro spec.
module Generated.Billing.Subscription.EventStream (
    subscriptionCategory,
    subscriptionEventStream,
    subscriptionEventStreamDef,
    SubscriptionEventStream,
    SubscriptionEventStreamDef,
) where

import Billing.Subscription.Holes (subscriptionTransducer)
import Generated.Billing.Subscription.Codec (subscriptionCodec)
import Generated.Billing.Subscription.Domain
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 a
subscriptionCategory = 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