{-# 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.SDB.Types.DeletableItem
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.SDB.Types.DeletableItem where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SDB.Types.Attribute

-- | /See:/ 'newDeletableItem' smart constructor.
data DeletableItem = DeletableItem'
  { DeletableItem -> Maybe [Attribute]
attributes :: Prelude.Maybe [Attribute],
    DeletableItem -> Text
name :: Prelude.Text
  }
  deriving (DeletableItem -> DeletableItem -> Bool
(DeletableItem -> DeletableItem -> Bool)
-> (DeletableItem -> DeletableItem -> Bool) -> Eq DeletableItem
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeletableItem -> DeletableItem -> Bool
$c/= :: DeletableItem -> DeletableItem -> Bool
== :: DeletableItem -> DeletableItem -> Bool
$c== :: DeletableItem -> DeletableItem -> Bool
Prelude.Eq, ReadPrec [DeletableItem]
ReadPrec DeletableItem
Int -> ReadS DeletableItem
ReadS [DeletableItem]
(Int -> ReadS DeletableItem)
-> ReadS [DeletableItem]
-> ReadPrec DeletableItem
-> ReadPrec [DeletableItem]
-> Read DeletableItem
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeletableItem]
$creadListPrec :: ReadPrec [DeletableItem]
readPrec :: ReadPrec DeletableItem
$creadPrec :: ReadPrec DeletableItem
readList :: ReadS [DeletableItem]
$creadList :: ReadS [DeletableItem]
readsPrec :: Int -> ReadS DeletableItem
$creadsPrec :: Int -> ReadS DeletableItem
Prelude.Read, Int -> DeletableItem -> ShowS
[DeletableItem] -> ShowS
DeletableItem -> String
(Int -> DeletableItem -> ShowS)
-> (DeletableItem -> String)
-> ([DeletableItem] -> ShowS)
-> Show DeletableItem
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeletableItem] -> ShowS
$cshowList :: [DeletableItem] -> ShowS
show :: DeletableItem -> String
$cshow :: DeletableItem -> String
showsPrec :: Int -> DeletableItem -> ShowS
$cshowsPrec :: Int -> DeletableItem -> ShowS
Prelude.Show, (forall x. DeletableItem -> Rep DeletableItem x)
-> (forall x. Rep DeletableItem x -> DeletableItem)
-> Generic DeletableItem
forall x. Rep DeletableItem x -> DeletableItem
forall x. DeletableItem -> Rep DeletableItem x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeletableItem x -> DeletableItem
$cfrom :: forall x. DeletableItem -> Rep DeletableItem x
Prelude.Generic)

-- |
-- Create a value of 'DeletableItem' 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:
--
-- 'attributes', 'deletableItem_attributes' - Undocumented member.
--
-- 'name', 'deletableItem_name' - Undocumented member.
newDeletableItem ::
  -- | 'name'
  Prelude.Text ->
  DeletableItem
newDeletableItem :: Text -> DeletableItem
newDeletableItem Text
pName_ =
  DeletableItem' :: Maybe [Attribute] -> Text -> DeletableItem
DeletableItem'
    { $sel:attributes:DeletableItem' :: Maybe [Attribute]
attributes = Maybe [Attribute]
forall a. Maybe a
Prelude.Nothing,
      $sel:name:DeletableItem' :: Text
name = Text
pName_
    }

-- | Undocumented member.
deletableItem_attributes :: Lens.Lens' DeletableItem (Prelude.Maybe [Attribute])
deletableItem_attributes :: (Maybe [Attribute] -> f (Maybe [Attribute]))
-> DeletableItem -> f DeletableItem
deletableItem_attributes = (DeletableItem -> Maybe [Attribute])
-> (DeletableItem -> Maybe [Attribute] -> DeletableItem)
-> Lens
     DeletableItem DeletableItem (Maybe [Attribute]) (Maybe [Attribute])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeletableItem' {Maybe [Attribute]
attributes :: Maybe [Attribute]
$sel:attributes:DeletableItem' :: DeletableItem -> Maybe [Attribute]
attributes} -> Maybe [Attribute]
attributes) (\s :: DeletableItem
s@DeletableItem' {} Maybe [Attribute]
a -> DeletableItem
s {$sel:attributes:DeletableItem' :: Maybe [Attribute]
attributes = Maybe [Attribute]
a} :: DeletableItem) ((Maybe [Attribute] -> f (Maybe [Attribute]))
 -> DeletableItem -> f DeletableItem)
-> ((Maybe [Attribute] -> f (Maybe [Attribute]))
    -> Maybe [Attribute] -> f (Maybe [Attribute]))
-> (Maybe [Attribute] -> f (Maybe [Attribute]))
-> DeletableItem
-> f DeletableItem
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Attribute] [Attribute] [Attribute] [Attribute]
-> Iso
     (Maybe [Attribute])
     (Maybe [Attribute])
     (Maybe [Attribute])
     (Maybe [Attribute])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Attribute] [Attribute] [Attribute] [Attribute]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Undocumented member.
deletableItem_name :: Lens.Lens' DeletableItem Prelude.Text
deletableItem_name :: (Text -> f Text) -> DeletableItem -> f DeletableItem
deletableItem_name = (DeletableItem -> Text)
-> (DeletableItem -> Text -> DeletableItem)
-> Lens DeletableItem DeletableItem Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeletableItem' {Text
name :: Text
$sel:name:DeletableItem' :: DeletableItem -> Text
name} -> Text
name) (\s :: DeletableItem
s@DeletableItem' {} Text
a -> DeletableItem
s {$sel:name:DeletableItem' :: Text
name = Text
a} :: DeletableItem)

instance Prelude.Hashable DeletableItem

instance Prelude.NFData DeletableItem

instance Core.ToQuery DeletableItem where
  toQuery :: DeletableItem -> QueryString
toQuery DeletableItem' {Maybe [Attribute]
Text
name :: Text
attributes :: Maybe [Attribute]
$sel:name:DeletableItem' :: DeletableItem -> Text
$sel:attributes:DeletableItem' :: DeletableItem -> Maybe [Attribute]
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
          ( ByteString -> [Attribute] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"Attribute"
              ([Attribute] -> QueryString)
-> Maybe [Attribute] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Attribute]
attributes
          ),
        ByteString
"ItemName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
name
      ]