packages feed

keiro-dsl-0.17.0.0: test/conformance-mapped-readmodel/Generated/MappedReadmodel/StructuralProjections.hs

{-# LANGUAGE TypeFamilies #-}
-- @generated by keiro-dsl 0.17.0.0 (language keiro-dsl 5) from context mapped-readmodel mapped structural facade; do not edit.
-- Equality witnesses are emitted for Text, Int, Bool, Natural, and UTCTime.
-- Nominal ID and enum leaves carry exact canonical-text domains.
-- Int, Natural, and UTCTime belong to Keiki's ordered subset.
module Generated.MappedReadmodel.StructuralProjections
  ( accountLookupAccountIdWitness
  , accountLookupAccountIdGet
  , accountLookupTenantTenantIdWitness
  , accountLookupTenantTenantIdGet
  , accountProfileDisplayNameWitness
  , accountProfileDisplayNameGet
  , accountSummaryAccountIdWitness
  , accountSummaryAccountIdGet
  , accountSummaryTenantTenantIdWitness
  , accountSummaryTenantTenantIdGet
  , tenantKeyTenantIdWitness
  , tenantKeyTenantIdGet
  , unusedFilterPrefixWitness
  , unusedFilterPrefixGet
  ) where

import Data.Text (Text)
import Keiro.Codec.Structural (bindingToShape)
import Keiki.Core (FieldProjection (..), FieldWitness, fieldWitness)
import Generated.MappedReadmodel.Structural.Shape.AccountLookup (AccountLookupShape(accountId, tenant))
import Generated.MappedReadmodel.Structural.Shape.AccountProfile (AccountProfileShape(displayName))
import Generated.MappedReadmodel.Structural.Shape.AccountSummary (AccountSummaryShape(accountId, tenant))
import Generated.MappedReadmodel.Structural.Shape.TenantKey (TenantKeyShape(tenantId))
import Generated.MappedReadmodel.Structural.Shape.UnusedFilter (UnusedFilterShape(prefix))
import Conformance.MappedReadModel.Bindings qualified as Bindings
import Conformance.MappedReadModel.Domain (AccountLookup, AccountProfile, AccountSummary, TenantKey, UnusedFilter)

data AccountLookupAccountIdProjection

accountLookupAccountIdGet :: AccountLookup -> Text
accountLookupAccountIdGet owner = (bindingToShape Bindings.accountLookupBinding owner).accountId

instance FieldProjection AccountLookupAccountIdProjection where
  type FieldName AccountLookupAccountIdProjection = "/account_id"
  type FieldOwner AccountLookupAccountIdProjection = AccountLookup
  type FieldResult AccountLookupAccountIdProjection = Text
  fieldShapeId _ = "conformance.mapped-readmodel.AccountLookup.v1"
  projectFieldValue _ = accountLookupAccountIdGet

accountLookupAccountIdWitness :: FieldWitness AccountLookupAccountIdProjection
accountLookupAccountIdWitness = fieldWitness @AccountLookupAccountIdProjection

data AccountLookupTenantTenantIdProjection

accountLookupTenantTenantIdGet :: AccountLookup -> Text
accountLookupTenantTenantIdGet owner = ((bindingToShape Bindings.accountLookupBinding owner).tenant).tenantId

instance FieldProjection AccountLookupTenantTenantIdProjection where
  type FieldName AccountLookupTenantTenantIdProjection = "/tenant/tenant_id"
  type FieldOwner AccountLookupTenantTenantIdProjection = AccountLookup
  type FieldResult AccountLookupTenantTenantIdProjection = Text
  fieldShapeId _ = "conformance.mapped-readmodel.AccountLookup.v1"
  projectFieldValue _ = accountLookupTenantTenantIdGet

accountLookupTenantTenantIdWitness :: FieldWitness AccountLookupTenantTenantIdProjection
accountLookupTenantTenantIdWitness = fieldWitness @AccountLookupTenantTenantIdProjection

data AccountProfileDisplayNameProjection

accountProfileDisplayNameGet :: AccountProfile -> Text
accountProfileDisplayNameGet owner = (bindingToShape Bindings.accountProfileBinding owner).displayName

instance FieldProjection AccountProfileDisplayNameProjection where
  type FieldName AccountProfileDisplayNameProjection = "/display_name"
  type FieldOwner AccountProfileDisplayNameProjection = AccountProfile
  type FieldResult AccountProfileDisplayNameProjection = Text
  fieldShapeId _ = "conformance.mapped-readmodel.AccountProfile.v1"
  projectFieldValue _ = accountProfileDisplayNameGet

accountProfileDisplayNameWitness :: FieldWitness AccountProfileDisplayNameProjection
accountProfileDisplayNameWitness = fieldWitness @AccountProfileDisplayNameProjection

data AccountSummaryAccountIdProjection

accountSummaryAccountIdGet :: AccountSummary -> Text
accountSummaryAccountIdGet owner = (bindingToShape Bindings.accountSummaryBinding owner).accountId

instance FieldProjection AccountSummaryAccountIdProjection where
  type FieldName AccountSummaryAccountIdProjection = "/account_id"
  type FieldOwner AccountSummaryAccountIdProjection = AccountSummary
  type FieldResult AccountSummaryAccountIdProjection = Text
  fieldShapeId _ = "conformance.mapped-readmodel.AccountSummary.v1"
  projectFieldValue _ = accountSummaryAccountIdGet

accountSummaryAccountIdWitness :: FieldWitness AccountSummaryAccountIdProjection
accountSummaryAccountIdWitness = fieldWitness @AccountSummaryAccountIdProjection

data AccountSummaryTenantTenantIdProjection

accountSummaryTenantTenantIdGet :: AccountSummary -> Text
accountSummaryTenantTenantIdGet owner = ((bindingToShape Bindings.accountSummaryBinding owner).tenant).tenantId

instance FieldProjection AccountSummaryTenantTenantIdProjection where
  type FieldName AccountSummaryTenantTenantIdProjection = "/tenant/tenant_id"
  type FieldOwner AccountSummaryTenantTenantIdProjection = AccountSummary
  type FieldResult AccountSummaryTenantTenantIdProjection = Text
  fieldShapeId _ = "conformance.mapped-readmodel.AccountSummary.v1"
  projectFieldValue _ = accountSummaryTenantTenantIdGet

accountSummaryTenantTenantIdWitness :: FieldWitness AccountSummaryTenantTenantIdProjection
accountSummaryTenantTenantIdWitness = fieldWitness @AccountSummaryTenantTenantIdProjection

data TenantKeyTenantIdProjection

tenantKeyTenantIdGet :: TenantKey -> Text
tenantKeyTenantIdGet owner = (bindingToShape Bindings.tenantKeyBinding owner).tenantId

instance FieldProjection TenantKeyTenantIdProjection where
  type FieldName TenantKeyTenantIdProjection = "/tenant_id"
  type FieldOwner TenantKeyTenantIdProjection = TenantKey
  type FieldResult TenantKeyTenantIdProjection = Text
  fieldShapeId _ = "conformance.mapped-readmodel.TenantKey.v1"
  projectFieldValue _ = tenantKeyTenantIdGet

tenantKeyTenantIdWitness :: FieldWitness TenantKeyTenantIdProjection
tenantKeyTenantIdWitness = fieldWitness @TenantKeyTenantIdProjection

data UnusedFilterPrefixProjection

unusedFilterPrefixGet :: UnusedFilter -> Text
unusedFilterPrefixGet owner = (bindingToShape Bindings.unusedFilterBinding owner).prefix

instance FieldProjection UnusedFilterPrefixProjection where
  type FieldName UnusedFilterPrefixProjection = "/prefix"
  type FieldOwner UnusedFilterPrefixProjection = UnusedFilter
  type FieldResult UnusedFilterPrefixProjection = Text
  fieldShapeId _ = "conformance.mapped-readmodel.UnusedFilter.v1"
  projectFieldValue _ = unusedFilterPrefixGet

unusedFilterPrefixWitness :: FieldWitness UnusedFilterPrefixProjection
unusedFilterPrefixWitness = fieldWitness @UnusedFilterPrefixProjection