{-# 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.SSM.Types.InventoryItemAttribute
-- 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.SSM.Types.InventoryItemAttribute where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.SSM.Types.InventoryAttributeDataType

-- | Attributes are the entries within the inventory item content. It
-- contains name and value.
--
-- /See:/ 'newInventoryItemAttribute' smart constructor.
data InventoryItemAttribute = InventoryItemAttribute'
  { -- | Name of the inventory item attribute.
    InventoryItemAttribute -> Text
name :: Prelude.Text,
    -- | The data type of the inventory item attribute.
    InventoryItemAttribute -> InventoryAttributeDataType
dataType :: InventoryAttributeDataType
  }
  deriving (InventoryItemAttribute -> InventoryItemAttribute -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InventoryItemAttribute -> InventoryItemAttribute -> Bool
$c/= :: InventoryItemAttribute -> InventoryItemAttribute -> Bool
== :: InventoryItemAttribute -> InventoryItemAttribute -> Bool
$c== :: InventoryItemAttribute -> InventoryItemAttribute -> Bool
Prelude.Eq, ReadPrec [InventoryItemAttribute]
ReadPrec InventoryItemAttribute
Int -> ReadS InventoryItemAttribute
ReadS [InventoryItemAttribute]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InventoryItemAttribute]
$creadListPrec :: ReadPrec [InventoryItemAttribute]
readPrec :: ReadPrec InventoryItemAttribute
$creadPrec :: ReadPrec InventoryItemAttribute
readList :: ReadS [InventoryItemAttribute]
$creadList :: ReadS [InventoryItemAttribute]
readsPrec :: Int -> ReadS InventoryItemAttribute
$creadsPrec :: Int -> ReadS InventoryItemAttribute
Prelude.Read, Int -> InventoryItemAttribute -> ShowS
[InventoryItemAttribute] -> ShowS
InventoryItemAttribute -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InventoryItemAttribute] -> ShowS
$cshowList :: [InventoryItemAttribute] -> ShowS
show :: InventoryItemAttribute -> String
$cshow :: InventoryItemAttribute -> String
showsPrec :: Int -> InventoryItemAttribute -> ShowS
$cshowsPrec :: Int -> InventoryItemAttribute -> ShowS
Prelude.Show, forall x. Rep InventoryItemAttribute x -> InventoryItemAttribute
forall x. InventoryItemAttribute -> Rep InventoryItemAttribute x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InventoryItemAttribute x -> InventoryItemAttribute
$cfrom :: forall x. InventoryItemAttribute -> Rep InventoryItemAttribute x
Prelude.Generic)

-- |
-- Create a value of 'InventoryItemAttribute' 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:
--
-- 'name', 'inventoryItemAttribute_name' - Name of the inventory item attribute.
--
-- 'dataType', 'inventoryItemAttribute_dataType' - The data type of the inventory item attribute.
newInventoryItemAttribute ::
  -- | 'name'
  Prelude.Text ->
  -- | 'dataType'
  InventoryAttributeDataType ->
  InventoryItemAttribute
newInventoryItemAttribute :: Text -> InventoryAttributeDataType -> InventoryItemAttribute
newInventoryItemAttribute Text
pName_ InventoryAttributeDataType
pDataType_ =
  InventoryItemAttribute'
    { $sel:name:InventoryItemAttribute' :: Text
name = Text
pName_,
      $sel:dataType:InventoryItemAttribute' :: InventoryAttributeDataType
dataType = InventoryAttributeDataType
pDataType_
    }

-- | Name of the inventory item attribute.
inventoryItemAttribute_name :: Lens.Lens' InventoryItemAttribute Prelude.Text
inventoryItemAttribute_name :: Lens' InventoryItemAttribute Text
inventoryItemAttribute_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InventoryItemAttribute' {Text
name :: Text
$sel:name:InventoryItemAttribute' :: InventoryItemAttribute -> Text
name} -> Text
name) (\s :: InventoryItemAttribute
s@InventoryItemAttribute' {} Text
a -> InventoryItemAttribute
s {$sel:name:InventoryItemAttribute' :: Text
name = Text
a} :: InventoryItemAttribute)

-- | The data type of the inventory item attribute.
inventoryItemAttribute_dataType :: Lens.Lens' InventoryItemAttribute InventoryAttributeDataType
inventoryItemAttribute_dataType :: Lens' InventoryItemAttribute InventoryAttributeDataType
inventoryItemAttribute_dataType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InventoryItemAttribute' {InventoryAttributeDataType
dataType :: InventoryAttributeDataType
$sel:dataType:InventoryItemAttribute' :: InventoryItemAttribute -> InventoryAttributeDataType
dataType} -> InventoryAttributeDataType
dataType) (\s :: InventoryItemAttribute
s@InventoryItemAttribute' {} InventoryAttributeDataType
a -> InventoryItemAttribute
s {$sel:dataType:InventoryItemAttribute' :: InventoryAttributeDataType
dataType = InventoryAttributeDataType
a} :: InventoryItemAttribute)

instance Data.FromJSON InventoryItemAttribute where
  parseJSON :: Value -> Parser InventoryItemAttribute
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"InventoryItemAttribute"
      ( \Object
x ->
          Text -> InventoryAttributeDataType -> InventoryItemAttribute
InventoryItemAttribute'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Name")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"DataType")
      )

instance Prelude.Hashable InventoryItemAttribute where
  hashWithSalt :: Int -> InventoryItemAttribute -> Int
hashWithSalt Int
_salt InventoryItemAttribute' {Text
InventoryAttributeDataType
dataType :: InventoryAttributeDataType
name :: Text
$sel:dataType:InventoryItemAttribute' :: InventoryItemAttribute -> InventoryAttributeDataType
$sel:name:InventoryItemAttribute' :: InventoryItemAttribute -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` InventoryAttributeDataType
dataType

instance Prelude.NFData InventoryItemAttribute where
  rnf :: InventoryItemAttribute -> ()
rnf InventoryItemAttribute' {Text
InventoryAttributeDataType
dataType :: InventoryAttributeDataType
name :: Text
$sel:dataType:InventoryItemAttribute' :: InventoryItemAttribute -> InventoryAttributeDataType
$sel:name:InventoryItemAttribute' :: InventoryItemAttribute -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
name seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf InventoryAttributeDataType
dataType