packages feed

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

{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeApplications #-}
-- @generated by keiro-dsl 0.8.0.0 (language keiro-dsl 4) from aggregate Thing; do not edit.
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, parseThingId)
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)
   ]

initialThingRegs :: RegFile ThingRegs
initialThingRegs =
  RCons (Proxy @"thingId") (case parseThingId "thing_01h455vb4pex5vsknk084sn02q" of Right parsed -> parsed; Left _ -> error "generated valid ID sample failed to parse") RNil

$(deriveAggregateCtorsAll ''ThingCommand ''ThingRegs)



$(deriveWireCtorsAll ''ThingEvent)