{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.DynamoDB.Types.TransactGetItem
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.DynamoDB.Types.TransactGetItem where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DynamoDB.Types.AttributeValue
import Amazonka.DynamoDB.Types.Get
import Amazonka.DynamoDB.Types.WriteRequest
import qualified Amazonka.Prelude as Prelude

-- | Specifies an item to be retrieved as part of the transaction.
--
-- /See:/ 'newTransactGetItem' smart constructor.
data TransactGetItem = TransactGetItem'
  { -- | Contains the primary key that identifies the item to get, together with
    -- the name of the table that contains the item, and optionally the
    -- specific attributes of the item to retrieve.
    TransactGetItem -> Get
get' :: Get
  }
  deriving (TransactGetItem -> TransactGetItem -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TransactGetItem -> TransactGetItem -> Bool
$c/= :: TransactGetItem -> TransactGetItem -> Bool
== :: TransactGetItem -> TransactGetItem -> Bool
$c== :: TransactGetItem -> TransactGetItem -> Bool
Prelude.Eq, ReadPrec [TransactGetItem]
ReadPrec TransactGetItem
Int -> ReadS TransactGetItem
ReadS [TransactGetItem]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TransactGetItem]
$creadListPrec :: ReadPrec [TransactGetItem]
readPrec :: ReadPrec TransactGetItem
$creadPrec :: ReadPrec TransactGetItem
readList :: ReadS [TransactGetItem]
$creadList :: ReadS [TransactGetItem]
readsPrec :: Int -> ReadS TransactGetItem
$creadsPrec :: Int -> ReadS TransactGetItem
Prelude.Read, Int -> TransactGetItem -> ShowS
[TransactGetItem] -> ShowS
TransactGetItem -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TransactGetItem] -> ShowS
$cshowList :: [TransactGetItem] -> ShowS
show :: TransactGetItem -> String
$cshow :: TransactGetItem -> String
showsPrec :: Int -> TransactGetItem -> ShowS
$cshowsPrec :: Int -> TransactGetItem -> ShowS
Prelude.Show, forall x. Rep TransactGetItem x -> TransactGetItem
forall x. TransactGetItem -> Rep TransactGetItem x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TransactGetItem x -> TransactGetItem
$cfrom :: forall x. TransactGetItem -> Rep TransactGetItem x
Prelude.Generic)

-- |
-- Create a value of 'TransactGetItem' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'get'', 'transactGetItem_get' - Contains the primary key that identifies the item to get, together with
-- the name of the table that contains the item, and optionally the
-- specific attributes of the item to retrieve.
newTransactGetItem ::
  -- | 'get''
  Get ->
  TransactGetItem
newTransactGetItem :: Get -> TransactGetItem
newTransactGetItem Get
pGet_ =
  TransactGetItem' {$sel:get':TransactGetItem' :: Get
get' = Get
pGet_}

-- | Contains the primary key that identifies the item to get, together with
-- the name of the table that contains the item, and optionally the
-- specific attributes of the item to retrieve.
transactGetItem_get :: Lens.Lens' TransactGetItem Get
transactGetItem_get :: Lens' TransactGetItem Get
transactGetItem_get = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TransactGetItem' {Get
get' :: Get
$sel:get':TransactGetItem' :: TransactGetItem -> Get
get'} -> Get
get') (\s :: TransactGetItem
s@TransactGetItem' {} Get
a -> TransactGetItem
s {$sel:get':TransactGetItem' :: Get
get' = Get
a} :: TransactGetItem)

instance Prelude.Hashable TransactGetItem where
  hashWithSalt :: Int -> TransactGetItem -> Int
hashWithSalt Int
_salt TransactGetItem' {Get
get' :: Get
$sel:get':TransactGetItem' :: TransactGetItem -> Get
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Get
get'

instance Prelude.NFData TransactGetItem where
  rnf :: TransactGetItem -> ()
rnf TransactGetItem' {Get
get' :: Get
$sel:get':TransactGetItem' :: TransactGetItem -> Get
..} = forall a. NFData a => a -> ()
Prelude.rnf Get
get'

instance Data.ToJSON TransactGetItem where
  toJSON :: TransactGetItem -> Value
toJSON TransactGetItem' {Get
get' :: Get
$sel:get':TransactGetItem' :: TransactGetItem -> Get
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"Get" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Get
get')]
      )