{-# 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.IdentityStore.Types.UniqueAttribute
-- 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.IdentityStore.Types.UniqueAttribute where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IdentityStore.Types.AttributeValue
import qualified Amazonka.Prelude as Prelude

-- | An entity attribute that\'s unique to a specific entity.
--
-- /See:/ 'newUniqueAttribute' smart constructor.
data UniqueAttribute = UniqueAttribute'
  { -- | A string representation of the path to a given attribute or
    -- sub-attribute. Supports JMESPath.
    UniqueAttribute -> Text
attributePath :: Prelude.Text,
    -- | The value of the attribute. This is a @Document@ type. This type is not
    -- supported by Java V1, Go V1, and older versions of the AWS CLI.
    UniqueAttribute -> AttributeValue
attributeValue :: AttributeValue
  }
  deriving (UniqueAttribute -> UniqueAttribute -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UniqueAttribute -> UniqueAttribute -> Bool
$c/= :: UniqueAttribute -> UniqueAttribute -> Bool
== :: UniqueAttribute -> UniqueAttribute -> Bool
$c== :: UniqueAttribute -> UniqueAttribute -> Bool
Prelude.Eq, ReadPrec [UniqueAttribute]
ReadPrec UniqueAttribute
Int -> ReadS UniqueAttribute
ReadS [UniqueAttribute]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UniqueAttribute]
$creadListPrec :: ReadPrec [UniqueAttribute]
readPrec :: ReadPrec UniqueAttribute
$creadPrec :: ReadPrec UniqueAttribute
readList :: ReadS [UniqueAttribute]
$creadList :: ReadS [UniqueAttribute]
readsPrec :: Int -> ReadS UniqueAttribute
$creadsPrec :: Int -> ReadS UniqueAttribute
Prelude.Read, Int -> UniqueAttribute -> ShowS
[UniqueAttribute] -> ShowS
UniqueAttribute -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UniqueAttribute] -> ShowS
$cshowList :: [UniqueAttribute] -> ShowS
show :: UniqueAttribute -> String
$cshow :: UniqueAttribute -> String
showsPrec :: Int -> UniqueAttribute -> ShowS
$cshowsPrec :: Int -> UniqueAttribute -> ShowS
Prelude.Show, forall x. Rep UniqueAttribute x -> UniqueAttribute
forall x. UniqueAttribute -> Rep UniqueAttribute x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UniqueAttribute x -> UniqueAttribute
$cfrom :: forall x. UniqueAttribute -> Rep UniqueAttribute x
Prelude.Generic)

-- |
-- Create a value of 'UniqueAttribute' 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:
--
-- 'attributePath', 'uniqueAttribute_attributePath' - A string representation of the path to a given attribute or
-- sub-attribute. Supports JMESPath.
--
-- 'attributeValue', 'uniqueAttribute_attributeValue' - The value of the attribute. This is a @Document@ type. This type is not
-- supported by Java V1, Go V1, and older versions of the AWS CLI.
newUniqueAttribute ::
  -- | 'attributePath'
  Prelude.Text ->
  -- | 'attributeValue'
  AttributeValue ->
  UniqueAttribute
newUniqueAttribute :: Text -> AttributeValue -> UniqueAttribute
newUniqueAttribute Text
pAttributePath_ AttributeValue
pAttributeValue_ =
  UniqueAttribute'
    { $sel:attributePath:UniqueAttribute' :: Text
attributePath = Text
pAttributePath_,
      $sel:attributeValue:UniqueAttribute' :: AttributeValue
attributeValue = AttributeValue
pAttributeValue_
    }

-- | A string representation of the path to a given attribute or
-- sub-attribute. Supports JMESPath.
uniqueAttribute_attributePath :: Lens.Lens' UniqueAttribute Prelude.Text
uniqueAttribute_attributePath :: Lens' UniqueAttribute Text
uniqueAttribute_attributePath = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UniqueAttribute' {Text
attributePath :: Text
$sel:attributePath:UniqueAttribute' :: UniqueAttribute -> Text
attributePath} -> Text
attributePath) (\s :: UniqueAttribute
s@UniqueAttribute' {} Text
a -> UniqueAttribute
s {$sel:attributePath:UniqueAttribute' :: Text
attributePath = Text
a} :: UniqueAttribute)

-- | The value of the attribute. This is a @Document@ type. This type is not
-- supported by Java V1, Go V1, and older versions of the AWS CLI.
uniqueAttribute_attributeValue :: Lens.Lens' UniqueAttribute AttributeValue
uniqueAttribute_attributeValue :: Lens' UniqueAttribute AttributeValue
uniqueAttribute_attributeValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UniqueAttribute' {AttributeValue
attributeValue :: AttributeValue
$sel:attributeValue:UniqueAttribute' :: UniqueAttribute -> AttributeValue
attributeValue} -> AttributeValue
attributeValue) (\s :: UniqueAttribute
s@UniqueAttribute' {} AttributeValue
a -> UniqueAttribute
s {$sel:attributeValue:UniqueAttribute' :: AttributeValue
attributeValue = AttributeValue
a} :: UniqueAttribute)

instance Prelude.Hashable UniqueAttribute where
  hashWithSalt :: Int -> UniqueAttribute -> Int
hashWithSalt Int
_salt UniqueAttribute' {Text
AttributeValue
attributeValue :: AttributeValue
attributePath :: Text
$sel:attributeValue:UniqueAttribute' :: UniqueAttribute -> AttributeValue
$sel:attributePath:UniqueAttribute' :: UniqueAttribute -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
attributePath
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` AttributeValue
attributeValue

instance Prelude.NFData UniqueAttribute where
  rnf :: UniqueAttribute -> ()
rnf UniqueAttribute' {Text
AttributeValue
attributeValue :: AttributeValue
attributePath :: Text
$sel:attributeValue:UniqueAttribute' :: UniqueAttribute -> AttributeValue
$sel:attributePath:UniqueAttribute' :: UniqueAttribute -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
attributePath
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf AttributeValue
attributeValue

instance Data.ToJSON UniqueAttribute where
  toJSON :: UniqueAttribute -> Value
toJSON UniqueAttribute' {Text
AttributeValue
attributeValue :: AttributeValue
attributePath :: Text
$sel:attributeValue:UniqueAttribute' :: UniqueAttribute -> AttributeValue
$sel:attributePath:UniqueAttribute' :: UniqueAttribute -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"AttributePath" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
attributePath),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"AttributeValue" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= AttributeValue
attributeValue)
          ]
      )