packages feed

keiro-dsl-0.2.0.0: test/conformance-workflow-runtime/Generated/HospitalCapacity/HospitalTransferReservation/WorkflowRuntime.hs

{-# LANGUAGE ImportQualifiedPost #-}
{-# LANGUAGE OverloadedStrings #-}

-- @generated by keiro-dsl; do not edit. Regenerated from the .keiro spec.
module Generated.HospitalCapacity.HospitalTransferReservation.WorkflowRuntime (
    workflowName,
    awaitAwakeableId,
    awaitLabels,
    declaredPatches,
    declaredPatchStepNames,
    withDeclaredPatches,
) where

import Data.Set (Set)
import Data.Set qualified as Set
import Data.Text (Text)
import Keiro.Workflow (WorkflowRunOptions (..))
import Keiro.Workflow.Awakeable (AwakeableId, deterministicAwakeableId)
import Keiro.Workflow.Types (PatchId (..), WorkflowId, WorkflowName (..), patchStepName)

workflowName :: WorkflowName
workflowName = WorkflowName "hospital-transfer-reservation"

-- The awakeable id an await allocates — the real deterministicAwakeableId.
-- A signal op deriving the same (name, id, label) gets the same id.
awaitAwakeableId :: WorkflowId -> Text -> AwakeableId
awaitAwakeableId wid label = deterministicAwakeableId workflowName wid label

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}