keiro-dsl-0.10.0.0: test/conformance-behavior-complete/Generated/BehaviorComplete/Journey/Domain.hs
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE TemplateHaskell #-}
-- @generated by keiro-dsl 0.9.0.0 (language keiro-dsl 4) from aggregate Journey; do not edit.
module Generated.BehaviorComplete.Journey.Domain where
import Data.Aeson (FromJSON, ToJSON)
import Data.Proxy (Proxy (..))
import Data.Text (Text)
import GHC.Generics (Generic)
import Keiki.Core (RegFile (..))
import Keiki.Shape (CanonicalStateShape, CanonicalTypeName)
import Generated.BehaviorComplete.Nominals (RequestId, parseRequestId)
import Data.Time.Calendar (fromGregorian)
import Data.Time.Clock (UTCTime(..), picosecondsToDiffTime)
import Numeric.Natural (Natural)
import BehaviorComplete.Domain (StartPayload)
import Keiki.Generics.TH (deriveAggregateCtorsAll, deriveWireCtorsAll)
data JourneyVertex = JourneyEmpty | JourneyActive | JourneyClosed
deriving stock (Generic, Eq, Ord, Show, Enum, Bounded)
deriving anyclass (ToJSON, FromJSON)
instance CanonicalStateShape JourneyVertex
instance CanonicalTypeName JourneyVertex
data StartData = StartData
{ requestId :: !RequestId
, observedAt :: !UTCTime
, amount :: !Natural
, details :: !StartPayload
}
deriving stock (Generic, Eq, Show)
data DecideData = DecideData
{ amount :: !Natural
}
deriving stock (Generic, Eq, Show)
data PingData = PingData
{ token :: !Bool
}
deriving stock (Generic, Eq, Show)
data RetireData = RetireData
{ amount :: !Natural
}
deriving stock (Generic, Eq, Show)
data JourneyCommand = Start !StartData
| Decide !DecideData
| Ping !PingData
| Retire !RetireData
deriving stock (Generic, Eq, Show)
data StartedData = StartedData
{ requestId :: !RequestId
, observedAt :: !UTCTime
, amount :: !Natural
, details :: !StartPayload
}
deriving stock (Generic, Eq, Show)
data DecisionRecordedData = DecisionRecordedData
{ amount :: !Natural
}
deriving stock (Generic, Eq, Show)
data RetiredData = RetiredData
{ amount :: !Natural
}
deriving stock (Generic, Eq, Show)
data RetirementAuditedData = RetirementAuditedData
{ amount :: !Natural
}
deriving stock (Generic, Eq, Show)
data JourneyEvent = Started !StartedData
| DecisionRecorded !DecisionRecordedData
| Retired !RetiredData
| RetirementAudited !RetirementAuditedData
deriving stock (Generic, Eq, Show)
type JourneyRegs =
'[ '("lastAmount", Natural)
]
initialJourneyRegs :: RegFile JourneyRegs
initialJourneyRegs =
RCons (Proxy @"lastAmount") 0 RNil
$(deriveAggregateCtorsAll ''JourneyCommand ''JourneyRegs)
$(deriveWireCtorsAll ''JourneyEvent)