{-# 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.Connect.Types.HierarchyLevel
-- 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.Connect.Types.HierarchyLevel where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contains information about a hierarchy level.
--
-- /See:/ 'newHierarchyLevel' smart constructor.
data HierarchyLevel = HierarchyLevel'
  { -- | The Amazon Resource Name (ARN) of the hierarchy level.
    HierarchyLevel -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The name of the hierarchy level.
    HierarchyLevel -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The identifier of the hierarchy level.
    HierarchyLevel -> Maybe Text
id :: Prelude.Maybe Prelude.Text
  }
  deriving (HierarchyLevel -> HierarchyLevel -> Bool
(HierarchyLevel -> HierarchyLevel -> Bool)
-> (HierarchyLevel -> HierarchyLevel -> Bool) -> Eq HierarchyLevel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HierarchyLevel -> HierarchyLevel -> Bool
$c/= :: HierarchyLevel -> HierarchyLevel -> Bool
== :: HierarchyLevel -> HierarchyLevel -> Bool
$c== :: HierarchyLevel -> HierarchyLevel -> Bool
Prelude.Eq, ReadPrec [HierarchyLevel]
ReadPrec HierarchyLevel
Int -> ReadS HierarchyLevel
ReadS [HierarchyLevel]
(Int -> ReadS HierarchyLevel)
-> ReadS [HierarchyLevel]
-> ReadPrec HierarchyLevel
-> ReadPrec [HierarchyLevel]
-> Read HierarchyLevel
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [HierarchyLevel]
$creadListPrec :: ReadPrec [HierarchyLevel]
readPrec :: ReadPrec HierarchyLevel
$creadPrec :: ReadPrec HierarchyLevel
readList :: ReadS [HierarchyLevel]
$creadList :: ReadS [HierarchyLevel]
readsPrec :: Int -> ReadS HierarchyLevel
$creadsPrec :: Int -> ReadS HierarchyLevel
Prelude.Read, Int -> HierarchyLevel -> ShowS
[HierarchyLevel] -> ShowS
HierarchyLevel -> String
(Int -> HierarchyLevel -> ShowS)
-> (HierarchyLevel -> String)
-> ([HierarchyLevel] -> ShowS)
-> Show HierarchyLevel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HierarchyLevel] -> ShowS
$cshowList :: [HierarchyLevel] -> ShowS
show :: HierarchyLevel -> String
$cshow :: HierarchyLevel -> String
showsPrec :: Int -> HierarchyLevel -> ShowS
$cshowsPrec :: Int -> HierarchyLevel -> ShowS
Prelude.Show, (forall x. HierarchyLevel -> Rep HierarchyLevel x)
-> (forall x. Rep HierarchyLevel x -> HierarchyLevel)
-> Generic HierarchyLevel
forall x. Rep HierarchyLevel x -> HierarchyLevel
forall x. HierarchyLevel -> Rep HierarchyLevel x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep HierarchyLevel x -> HierarchyLevel
$cfrom :: forall x. HierarchyLevel -> Rep HierarchyLevel x
Prelude.Generic)

-- |
-- Create a value of 'HierarchyLevel' 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:
--
-- 'arn', 'hierarchyLevel_arn' - The Amazon Resource Name (ARN) of the hierarchy level.
--
-- 'name', 'hierarchyLevel_name' - The name of the hierarchy level.
--
-- 'id', 'hierarchyLevel_id' - The identifier of the hierarchy level.
newHierarchyLevel ::
  HierarchyLevel
newHierarchyLevel :: HierarchyLevel
newHierarchyLevel =
  HierarchyLevel' :: Maybe Text -> Maybe Text -> Maybe Text -> HierarchyLevel
HierarchyLevel'
    { $sel:arn:HierarchyLevel' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:HierarchyLevel' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:HierarchyLevel' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) of the hierarchy level.
hierarchyLevel_arn :: Lens.Lens' HierarchyLevel (Prelude.Maybe Prelude.Text)
hierarchyLevel_arn :: (Maybe Text -> f (Maybe Text))
-> HierarchyLevel -> f HierarchyLevel
hierarchyLevel_arn = (HierarchyLevel -> Maybe Text)
-> (HierarchyLevel -> Maybe Text -> HierarchyLevel)
-> Lens HierarchyLevel HierarchyLevel (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HierarchyLevel' {Maybe Text
arn :: Maybe Text
$sel:arn:HierarchyLevel' :: HierarchyLevel -> Maybe Text
arn} -> Maybe Text
arn) (\s :: HierarchyLevel
s@HierarchyLevel' {} Maybe Text
a -> HierarchyLevel
s {$sel:arn:HierarchyLevel' :: Maybe Text
arn = Maybe Text
a} :: HierarchyLevel)

-- | The name of the hierarchy level.
hierarchyLevel_name :: Lens.Lens' HierarchyLevel (Prelude.Maybe Prelude.Text)
hierarchyLevel_name :: (Maybe Text -> f (Maybe Text))
-> HierarchyLevel -> f HierarchyLevel
hierarchyLevel_name = (HierarchyLevel -> Maybe Text)
-> (HierarchyLevel -> Maybe Text -> HierarchyLevel)
-> Lens HierarchyLevel HierarchyLevel (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HierarchyLevel' {Maybe Text
name :: Maybe Text
$sel:name:HierarchyLevel' :: HierarchyLevel -> Maybe Text
name} -> Maybe Text
name) (\s :: HierarchyLevel
s@HierarchyLevel' {} Maybe Text
a -> HierarchyLevel
s {$sel:name:HierarchyLevel' :: Maybe Text
name = Maybe Text
a} :: HierarchyLevel)

-- | The identifier of the hierarchy level.
hierarchyLevel_id :: Lens.Lens' HierarchyLevel (Prelude.Maybe Prelude.Text)
hierarchyLevel_id :: (Maybe Text -> f (Maybe Text))
-> HierarchyLevel -> f HierarchyLevel
hierarchyLevel_id = (HierarchyLevel -> Maybe Text)
-> (HierarchyLevel -> Maybe Text -> HierarchyLevel)
-> Lens HierarchyLevel HierarchyLevel (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HierarchyLevel' {Maybe Text
id :: Maybe Text
$sel:id:HierarchyLevel' :: HierarchyLevel -> Maybe Text
id} -> Maybe Text
id) (\s :: HierarchyLevel
s@HierarchyLevel' {} Maybe Text
a -> HierarchyLevel
s {$sel:id:HierarchyLevel' :: Maybe Text
id = Maybe Text
a} :: HierarchyLevel)

instance Core.FromJSON HierarchyLevel where
  parseJSON :: Value -> Parser HierarchyLevel
parseJSON =
    String
-> (Object -> Parser HierarchyLevel)
-> Value
-> Parser HierarchyLevel
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"HierarchyLevel"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe Text -> HierarchyLevel
HierarchyLevel'
            (Maybe Text -> Maybe Text -> Maybe Text -> HierarchyLevel)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> HierarchyLevel)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Arn")
            Parser (Maybe Text -> Maybe Text -> HierarchyLevel)
-> Parser (Maybe Text) -> Parser (Maybe Text -> HierarchyLevel)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Name")
            Parser (Maybe Text -> HierarchyLevel)
-> Parser (Maybe Text) -> Parser HierarchyLevel
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Id")
      )

instance Prelude.Hashable HierarchyLevel

instance Prelude.NFData HierarchyLevel