{-# 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.CloudDirectory.Types.TypedLinkAttributeRange
-- 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.CloudDirectory.Types.TypedLinkAttributeRange where

import Amazonka.CloudDirectory.Types.TypedAttributeValueRange
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Identifies the range of attributes that are used by a specified filter.
--
-- /See:/ 'newTypedLinkAttributeRange' smart constructor.
data TypedLinkAttributeRange = TypedLinkAttributeRange'
  { -- | The unique name of the typed link attribute.
    TypedLinkAttributeRange -> Maybe Text
attributeName :: Prelude.Maybe Prelude.Text,
    -- | The range of attribute values that are being selected.
    TypedLinkAttributeRange -> TypedAttributeValueRange
range :: TypedAttributeValueRange
  }
  deriving (TypedLinkAttributeRange -> TypedLinkAttributeRange -> Bool
(TypedLinkAttributeRange -> TypedLinkAttributeRange -> Bool)
-> (TypedLinkAttributeRange -> TypedLinkAttributeRange -> Bool)
-> Eq TypedLinkAttributeRange
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TypedLinkAttributeRange -> TypedLinkAttributeRange -> Bool
$c/= :: TypedLinkAttributeRange -> TypedLinkAttributeRange -> Bool
== :: TypedLinkAttributeRange -> TypedLinkAttributeRange -> Bool
$c== :: TypedLinkAttributeRange -> TypedLinkAttributeRange -> Bool
Prelude.Eq, ReadPrec [TypedLinkAttributeRange]
ReadPrec TypedLinkAttributeRange
Int -> ReadS TypedLinkAttributeRange
ReadS [TypedLinkAttributeRange]
(Int -> ReadS TypedLinkAttributeRange)
-> ReadS [TypedLinkAttributeRange]
-> ReadPrec TypedLinkAttributeRange
-> ReadPrec [TypedLinkAttributeRange]
-> Read TypedLinkAttributeRange
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TypedLinkAttributeRange]
$creadListPrec :: ReadPrec [TypedLinkAttributeRange]
readPrec :: ReadPrec TypedLinkAttributeRange
$creadPrec :: ReadPrec TypedLinkAttributeRange
readList :: ReadS [TypedLinkAttributeRange]
$creadList :: ReadS [TypedLinkAttributeRange]
readsPrec :: Int -> ReadS TypedLinkAttributeRange
$creadsPrec :: Int -> ReadS TypedLinkAttributeRange
Prelude.Read, Int -> TypedLinkAttributeRange -> ShowS
[TypedLinkAttributeRange] -> ShowS
TypedLinkAttributeRange -> String
(Int -> TypedLinkAttributeRange -> ShowS)
-> (TypedLinkAttributeRange -> String)
-> ([TypedLinkAttributeRange] -> ShowS)
-> Show TypedLinkAttributeRange
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TypedLinkAttributeRange] -> ShowS
$cshowList :: [TypedLinkAttributeRange] -> ShowS
show :: TypedLinkAttributeRange -> String
$cshow :: TypedLinkAttributeRange -> String
showsPrec :: Int -> TypedLinkAttributeRange -> ShowS
$cshowsPrec :: Int -> TypedLinkAttributeRange -> ShowS
Prelude.Show, (forall x.
 TypedLinkAttributeRange -> Rep TypedLinkAttributeRange x)
-> (forall x.
    Rep TypedLinkAttributeRange x -> TypedLinkAttributeRange)
-> Generic TypedLinkAttributeRange
forall x. Rep TypedLinkAttributeRange x -> TypedLinkAttributeRange
forall x. TypedLinkAttributeRange -> Rep TypedLinkAttributeRange x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TypedLinkAttributeRange x -> TypedLinkAttributeRange
$cfrom :: forall x. TypedLinkAttributeRange -> Rep TypedLinkAttributeRange x
Prelude.Generic)

-- |
-- Create a value of 'TypedLinkAttributeRange' 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:
--
-- 'attributeName', 'typedLinkAttributeRange_attributeName' - The unique name of the typed link attribute.
--
-- 'range', 'typedLinkAttributeRange_range' - The range of attribute values that are being selected.
newTypedLinkAttributeRange ::
  -- | 'range'
  TypedAttributeValueRange ->
  TypedLinkAttributeRange
newTypedLinkAttributeRange :: TypedAttributeValueRange -> TypedLinkAttributeRange
newTypedLinkAttributeRange TypedAttributeValueRange
pRange_ =
  TypedLinkAttributeRange' :: Maybe Text -> TypedAttributeValueRange -> TypedLinkAttributeRange
TypedLinkAttributeRange'
    { $sel:attributeName:TypedLinkAttributeRange' :: Maybe Text
attributeName =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:range:TypedLinkAttributeRange' :: TypedAttributeValueRange
range = TypedAttributeValueRange
pRange_
    }

-- | The unique name of the typed link attribute.
typedLinkAttributeRange_attributeName :: Lens.Lens' TypedLinkAttributeRange (Prelude.Maybe Prelude.Text)
typedLinkAttributeRange_attributeName :: (Maybe Text -> f (Maybe Text))
-> TypedLinkAttributeRange -> f TypedLinkAttributeRange
typedLinkAttributeRange_attributeName = (TypedLinkAttributeRange -> Maybe Text)
-> (TypedLinkAttributeRange
    -> Maybe Text -> TypedLinkAttributeRange)
-> Lens
     TypedLinkAttributeRange
     TypedLinkAttributeRange
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TypedLinkAttributeRange' {Maybe Text
attributeName :: Maybe Text
$sel:attributeName:TypedLinkAttributeRange' :: TypedLinkAttributeRange -> Maybe Text
attributeName} -> Maybe Text
attributeName) (\s :: TypedLinkAttributeRange
s@TypedLinkAttributeRange' {} Maybe Text
a -> TypedLinkAttributeRange
s {$sel:attributeName:TypedLinkAttributeRange' :: Maybe Text
attributeName = Maybe Text
a} :: TypedLinkAttributeRange)

-- | The range of attribute values that are being selected.
typedLinkAttributeRange_range :: Lens.Lens' TypedLinkAttributeRange TypedAttributeValueRange
typedLinkAttributeRange_range :: (TypedAttributeValueRange -> f TypedAttributeValueRange)
-> TypedLinkAttributeRange -> f TypedLinkAttributeRange
typedLinkAttributeRange_range = (TypedLinkAttributeRange -> TypedAttributeValueRange)
-> (TypedLinkAttributeRange
    -> TypedAttributeValueRange -> TypedLinkAttributeRange)
-> Lens
     TypedLinkAttributeRange
     TypedLinkAttributeRange
     TypedAttributeValueRange
     TypedAttributeValueRange
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TypedLinkAttributeRange' {TypedAttributeValueRange
range :: TypedAttributeValueRange
$sel:range:TypedLinkAttributeRange' :: TypedLinkAttributeRange -> TypedAttributeValueRange
range} -> TypedAttributeValueRange
range) (\s :: TypedLinkAttributeRange
s@TypedLinkAttributeRange' {} TypedAttributeValueRange
a -> TypedLinkAttributeRange
s {$sel:range:TypedLinkAttributeRange' :: TypedAttributeValueRange
range = TypedAttributeValueRange
a} :: TypedLinkAttributeRange)

instance Prelude.Hashable TypedLinkAttributeRange

instance Prelude.NFData TypedLinkAttributeRange

instance Core.ToJSON TypedLinkAttributeRange where
  toJSON :: TypedLinkAttributeRange -> Value
toJSON TypedLinkAttributeRange' {Maybe Text
TypedAttributeValueRange
range :: TypedAttributeValueRange
attributeName :: Maybe Text
$sel:range:TypedLinkAttributeRange' :: TypedLinkAttributeRange -> TypedAttributeValueRange
$sel:attributeName:TypedLinkAttributeRange' :: TypedLinkAttributeRange -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"AttributeName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
attributeName,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Range" Text -> TypedAttributeValueRange -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= TypedAttributeValueRange
range)
          ]
      )