keiro-dsl-0.12.0.0: test/conformance-workflow-full/Generated/HospitalCapacity/HospitalTransferReservation/WorkflowRuntime.hs
-- @generated by keiro-dsl 0.12.0.0 (language keiro-dsl 5) from workflow HospitalTransferReservation; do not edit.
module Generated.HospitalCapacity.HospitalTransferReservation.WorkflowRuntime
( workflowName
, AwaitBinding
, allocateDeclaredAwait
, reservationConfirmationAwait
, awaitLabels
, declaredPatches
, declaredPatchStepNames
, withDeclaredPatches
) where
import Data.Aeson (FromJSON)
import Data.Set (Set)
import Data.Set qualified as Set
import Data.Text (Text)
import Effectful (Eff, IOE, (:>))
import Keiro.Workflow (StepName (..), Workflow, WorkflowRunOptions (..))
import Keiro.Workflow.Awakeable (AwakeableId, awakeableNamed)
import Keiro.Workflow.Types (PatchId (..), WorkflowName (..), patchStepName)
import Kiroku.Store.Effect (Store)
workflowName :: WorkflowName
workflowName = WorkflowName "hospital-transfer-reservation"
-- | A declared await label. The constructor stays private so consumers
-- can allocate only labels that exist in the source workflow.
data AwaitBinding = AwaitBinding StepName
allocateDeclaredAwait
:: (Workflow :> es, Store :> es, IOE :> es, FromJSON a)
=> AwaitBinding
-> Eff es (AwakeableId, Eff es a)
allocateDeclaredAwait (AwaitBinding label) = awakeableNamed label
reservationConfirmationAwait :: AwaitBinding
reservationConfirmationAwait = AwaitBinding (StepName "reservation-confirmation")
awaitLabels :: [Text]
awaitLabels = ["reservation-confirmation"]
declaredPatches :: Set PatchId
declaredPatches = Set.fromList [PatchId "fraud-check-v2"]
-- The journal keys the runtime records patch decisions under.
declaredPatchStepNames :: [Text]
declaredPatchStepNames = map patchStepName (Set.toList declaredPatches)
-- Activate exactly the patches declared by this spec for a workflow run.
withDeclaredPatches :: WorkflowRunOptions -> WorkflowRunOptions
withDeclaredPatches opts = opts{activePatches = declaredPatches}