keiro-dsl-0.18.0.0: test/conformance-refined-base16/Generated/RefinedBase16/HashStore/Domain.hs
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE TemplateHaskell #-}
-- @generated by keiro-dsl 0.18.0.0 (language keiro-dsl 6) from aggregate HashStore; do not edit.
module Generated.RefinedBase16.HashStore.Domain where
import Data.Aeson (FromJSON, ToJSON)
import Data.Proxy (Proxy (..))
import GHC.Generics (Generic)
import Keiki.Core (RegFile (..))
import Keiki.Shape (CanonicalStateShape, CanonicalTypeName)
import Conformance.RefinedBase16.Bindings qualified as Bindings
import Conformance.RefinedBase16.Domain (ContentHash, HashEnvelope, MaybeContentHash)
import Keiki.Generics.TH (deriveAggregateCtorsAll, deriveWireCtorsAll)
data HashStoreVertex = HashStoreEmpty | HashStoreStored
deriving stock (Generic, Eq, Ord, Show, Enum, Bounded)
deriving anyclass (ToJSON, FromJSON)
instance CanonicalStateShape HashStoreVertex
instance CanonicalTypeName HashStoreVertex
data StoreHashData = StoreHashData
{ hash :: !ContentHash
, optionalHash :: !MaybeContentHash
, envelope :: !HashEnvelope
}
deriving stock (Generic, Eq, Show)
data ImportLegacyHashData = ImportLegacyHashData
{ hash :: !ContentHash
, optionalHash :: !MaybeContentHash
, envelope :: !HashEnvelope
}
deriving stock (Generic, Eq, Show)
data HashStoreCommand = StoreHash !StoreHashData
| ImportLegacyHash !ImportLegacyHashData
deriving stock (Generic, Eq, Show)
data HashStoredData = HashStoredData
{ hash :: !ContentHash
, optionalHash :: !MaybeContentHash
, envelope :: !HashEnvelope
}
deriving stock (Generic, Eq, Show)
data HashAuditedData = HashAuditedData
{ hash :: !ContentHash
, optionalHash :: !MaybeContentHash
, envelope :: !HashEnvelope
}
deriving stock (Generic, Eq, Show)
data LegacyHashImportedData = LegacyHashImportedData
{ hash :: !ContentHash
, optionalHash :: !MaybeContentHash
, envelope :: !HashEnvelope
}
deriving stock (Generic, Eq, Show)
data HashStoreEvent = HashStored !HashStoredData
| HashAudited !HashAuditedData
| LegacyHashImported !LegacyHashImportedData
deriving stock (Generic, Eq, Show)
type HashStoreRegs =
'[ '("current", ContentHash)
]
initialHashStoreRegs :: RegFile HashStoreRegs
initialHashStoreRegs =
RCons (Proxy @"current") Bindings.initialContentHash RNil
$(deriveAggregateCtorsAll ''HashStoreCommand ''HashStoreRegs)
$(deriveWireCtorsAll ''HashStoreEvent)