packages feed

keiro-dsl-0.7.0.0: test/conformance-skeletons/SkelAggregate/Generated/MyService/Thing/Domain.hs

{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeApplications #-}
{-# OPTIONS_GHC -Wno-unused-top-binds #-}
-- @generated by keiro-dsl; do not edit. Regenerated from the .keiro spec.
module SkelAggregate.Generated.MyService.Thing.Domain where

import Data.Proxy (Proxy (..))
import Data.Text (Text)
import GHC.Generics (Generic)
import Keiki.Core (RegFile (..))
import SkelAggregate.Generated.MyService.Nominals (ThingId (..))
import Keiki.Generics.TH (deriveAggregateCtorsAll, deriveWireCtorsAll)

data ThingVertex = ThingPending | ThingDone
  deriving stock (Generic, Eq, Ord, Show, Enum, Bounded)

data DoThingData = DoThingData
  { thingId :: !ThingId
  , attempt :: !Int
  }
  deriving stock (Generic, Eq, Show)

data ThingCommand = DoThing !DoThingData
  deriving stock (Generic, Eq, Show)

data ThingCompletedData = ThingCompletedData
  { thingId :: !ThingId
  , attempt :: !Int
  }
  deriving stock (Generic, Eq, Show)

data ThingEvent = ThingCompleted !ThingCompletedData
  deriving stock (Generic, Eq, Show)

type ThingRegs =
  '[ '("thingId", ThingId)
   , '("state", ThingVertex)
   ]

initialThingRegs :: RegFile ThingRegs
initialThingRegs =
  RCons (Proxy @"thingId") (ThingId "") $
  RCons (Proxy @"state") ThingPending RNil

$(deriveAggregateCtorsAll ''ThingCommand ''ThingRegs)



$(deriveWireCtorsAll ''ThingEvent)