packages feed

keiro-dsl-0.7.0.0: test/conformance/Generated/HospitalCapacity/Nominals.hs

{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE LambdaCase #-}
-- @generated by keiro-dsl; do not edit. Regenerated from the .keiro spec.
module Generated.HospitalCapacity.Nominals where

import Data.Aeson (FromJSON, ToJSON)
import Data.Text (Text)
import GHC.Generics (Generic)
import Keiki.Shape (CanonicalTypeName)

data BedType = Icu | MedicalSurgical
  deriving stock (Generic, Eq, Ord, Show, Enum, Bounded)
  deriving anyclass (ToJSON, FromJSON)

instance CanonicalTypeName BedType

bedTypeText :: BedType -> Text
bedTypeText = \case
  Icu -> "icu"
  MedicalSurgical -> "medical-surgical"

newtype CommandId = CommandId Text
  deriving stock (Generic, Eq, Ord, Show)
  deriving anyclass (ToJSON, FromJSON)

instance CanonicalTypeName CommandId

commandIdText :: CommandId -> Text
commandIdText (CommandId value) = value

data DivertStatus = Open | PartialDivert | TotalDivert
  deriving stock (Generic, Eq, Ord, Show, Enum, Bounded)
  deriving anyclass (ToJSON, FromJSON)

instance CanonicalTypeName DivertStatus

divertStatusText :: DivertStatus -> Text
divertStatusText = \case
  Open -> "open"
  PartialDivert -> "partial-divert"
  TotalDivert -> "total-divert"

newtype HospitalId = HospitalId Text
  deriving stock (Generic, Eq, Ord, Show)
  deriving anyclass (ToJSON, FromJSON)

instance CanonicalTypeName HospitalId

hospitalIdText :: HospitalId -> Text
hospitalIdText (HospitalId value) = value

data PatientAcuity = RedTag | YellowTag | GreenTag
  deriving stock (Generic, Eq, Ord, Show, Enum, Bounded)
  deriving anyclass (ToJSON, FromJSON)

instance CanonicalTypeName PatientAcuity

patientAcuityText :: PatientAcuity -> Text
patientAcuityText = \case
  RedTag -> "red"
  YellowTag -> "yellow"
  GreenTag -> "green"

newtype TransferReservationId = TransferReservationId Text
  deriving stock (Generic, Eq, Ord, Show)
  deriving anyclass (ToJSON, FromJSON)

instance CanonicalTypeName TransferReservationId

transferReservationIdText :: TransferReservationId -> Text
transferReservationIdText (TransferReservationId value) = value