packages feed

keiro-dsl-0.2.0.0: test/conformance-process-full/Generated/SurgeDemo/Hospital/Projection.hs

{-# LANGUAGE OverloadedRecordDot #-}
{-# LANGUAGE OverloadedStrings #-}

-- @generated by keiro-dsl; do not edit. Regenerated from the .keiro spec.
module Generated.SurgeDemo.Hospital.Projection (
    hospitalProjection,
    hospitalStatusFor,
) where

import Data.Text (Text)
import Generated.SurgeDemo.Hospital.Domain
import Keiro.Projection (InlineProjection (..))
import SurgeDemo.Hospital.Holes (applyHospital)

-- The deterministic event->status mapping (hole-kind 3, /mapping/), derived
-- from the spec's status-map. The read-model SQL that consumes it lives in
-- the hand-owned Holes module (a DB-coupled hole, delegated to codd).
-- WARNING: no readmodel node declares 'hospital'; unqualified SQL depends on search_path.
hospitalStatusFor :: HospitalEvent -> Maybe Text
hospitalStatusFor = \case
    SurgeActivated{} -> Just "surging"

hospitalProjection :: InlineProjection HospitalEvent
hospitalProjection =
    InlineProjection
        { name = "surge-demo-hospital-inline"
        , apply = applyHospital
        }