{-# 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.HierarchyStructure
-- 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.HierarchyStructure where

import Amazonka.Connect.Types.HierarchyLevel
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contains information about a hierarchy structure.
--
-- /See:/ 'newHierarchyStructure' smart constructor.
data HierarchyStructure = HierarchyStructure'
  { -- | Information about level five.
    HierarchyStructure -> Maybe HierarchyLevel
levelFive :: Prelude.Maybe HierarchyLevel,
    -- | Information about level three.
    HierarchyStructure -> Maybe HierarchyLevel
levelThree :: Prelude.Maybe HierarchyLevel,
    -- | Information about level four.
    HierarchyStructure -> Maybe HierarchyLevel
levelFour :: Prelude.Maybe HierarchyLevel,
    -- | Information about level two.
    HierarchyStructure -> Maybe HierarchyLevel
levelTwo :: Prelude.Maybe HierarchyLevel,
    -- | Information about level one.
    HierarchyStructure -> Maybe HierarchyLevel
levelOne :: Prelude.Maybe HierarchyLevel
  }
  deriving (HierarchyStructure -> HierarchyStructure -> Bool
(HierarchyStructure -> HierarchyStructure -> Bool)
-> (HierarchyStructure -> HierarchyStructure -> Bool)
-> Eq HierarchyStructure
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HierarchyStructure -> HierarchyStructure -> Bool
$c/= :: HierarchyStructure -> HierarchyStructure -> Bool
== :: HierarchyStructure -> HierarchyStructure -> Bool
$c== :: HierarchyStructure -> HierarchyStructure -> Bool
Prelude.Eq, ReadPrec [HierarchyStructure]
ReadPrec HierarchyStructure
Int -> ReadS HierarchyStructure
ReadS [HierarchyStructure]
(Int -> ReadS HierarchyStructure)
-> ReadS [HierarchyStructure]
-> ReadPrec HierarchyStructure
-> ReadPrec [HierarchyStructure]
-> Read HierarchyStructure
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [HierarchyStructure]
$creadListPrec :: ReadPrec [HierarchyStructure]
readPrec :: ReadPrec HierarchyStructure
$creadPrec :: ReadPrec HierarchyStructure
readList :: ReadS [HierarchyStructure]
$creadList :: ReadS [HierarchyStructure]
readsPrec :: Int -> ReadS HierarchyStructure
$creadsPrec :: Int -> ReadS HierarchyStructure
Prelude.Read, Int -> HierarchyStructure -> ShowS
[HierarchyStructure] -> ShowS
HierarchyStructure -> String
(Int -> HierarchyStructure -> ShowS)
-> (HierarchyStructure -> String)
-> ([HierarchyStructure] -> ShowS)
-> Show HierarchyStructure
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HierarchyStructure] -> ShowS
$cshowList :: [HierarchyStructure] -> ShowS
show :: HierarchyStructure -> String
$cshow :: HierarchyStructure -> String
showsPrec :: Int -> HierarchyStructure -> ShowS
$cshowsPrec :: Int -> HierarchyStructure -> ShowS
Prelude.Show, (forall x. HierarchyStructure -> Rep HierarchyStructure x)
-> (forall x. Rep HierarchyStructure x -> HierarchyStructure)
-> Generic HierarchyStructure
forall x. Rep HierarchyStructure x -> HierarchyStructure
forall x. HierarchyStructure -> Rep HierarchyStructure x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep HierarchyStructure x -> HierarchyStructure
$cfrom :: forall x. HierarchyStructure -> Rep HierarchyStructure x
Prelude.Generic)

-- |
-- Create a value of 'HierarchyStructure' 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:
--
-- 'levelFive', 'hierarchyStructure_levelFive' - Information about level five.
--
-- 'levelThree', 'hierarchyStructure_levelThree' - Information about level three.
--
-- 'levelFour', 'hierarchyStructure_levelFour' - Information about level four.
--
-- 'levelTwo', 'hierarchyStructure_levelTwo' - Information about level two.
--
-- 'levelOne', 'hierarchyStructure_levelOne' - Information about level one.
newHierarchyStructure ::
  HierarchyStructure
newHierarchyStructure :: HierarchyStructure
newHierarchyStructure =
  HierarchyStructure' :: Maybe HierarchyLevel
-> Maybe HierarchyLevel
-> Maybe HierarchyLevel
-> Maybe HierarchyLevel
-> Maybe HierarchyLevel
-> HierarchyStructure
HierarchyStructure'
    { $sel:levelFive:HierarchyStructure' :: Maybe HierarchyLevel
levelFive = Maybe HierarchyLevel
forall a. Maybe a
Prelude.Nothing,
      $sel:levelThree:HierarchyStructure' :: Maybe HierarchyLevel
levelThree = Maybe HierarchyLevel
forall a. Maybe a
Prelude.Nothing,
      $sel:levelFour:HierarchyStructure' :: Maybe HierarchyLevel
levelFour = Maybe HierarchyLevel
forall a. Maybe a
Prelude.Nothing,
      $sel:levelTwo:HierarchyStructure' :: Maybe HierarchyLevel
levelTwo = Maybe HierarchyLevel
forall a. Maybe a
Prelude.Nothing,
      $sel:levelOne:HierarchyStructure' :: Maybe HierarchyLevel
levelOne = Maybe HierarchyLevel
forall a. Maybe a
Prelude.Nothing
    }

-- | Information about level five.
hierarchyStructure_levelFive :: Lens.Lens' HierarchyStructure (Prelude.Maybe HierarchyLevel)
hierarchyStructure_levelFive :: (Maybe HierarchyLevel -> f (Maybe HierarchyLevel))
-> HierarchyStructure -> f HierarchyStructure
hierarchyStructure_levelFive = (HierarchyStructure -> Maybe HierarchyLevel)
-> (HierarchyStructure
    -> Maybe HierarchyLevel -> HierarchyStructure)
-> Lens
     HierarchyStructure
     HierarchyStructure
     (Maybe HierarchyLevel)
     (Maybe HierarchyLevel)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HierarchyStructure' {Maybe HierarchyLevel
levelFive :: Maybe HierarchyLevel
$sel:levelFive:HierarchyStructure' :: HierarchyStructure -> Maybe HierarchyLevel
levelFive} -> Maybe HierarchyLevel
levelFive) (\s :: HierarchyStructure
s@HierarchyStructure' {} Maybe HierarchyLevel
a -> HierarchyStructure
s {$sel:levelFive:HierarchyStructure' :: Maybe HierarchyLevel
levelFive = Maybe HierarchyLevel
a} :: HierarchyStructure)

-- | Information about level three.
hierarchyStructure_levelThree :: Lens.Lens' HierarchyStructure (Prelude.Maybe HierarchyLevel)
hierarchyStructure_levelThree :: (Maybe HierarchyLevel -> f (Maybe HierarchyLevel))
-> HierarchyStructure -> f HierarchyStructure
hierarchyStructure_levelThree = (HierarchyStructure -> Maybe HierarchyLevel)
-> (HierarchyStructure
    -> Maybe HierarchyLevel -> HierarchyStructure)
-> Lens
     HierarchyStructure
     HierarchyStructure
     (Maybe HierarchyLevel)
     (Maybe HierarchyLevel)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HierarchyStructure' {Maybe HierarchyLevel
levelThree :: Maybe HierarchyLevel
$sel:levelThree:HierarchyStructure' :: HierarchyStructure -> Maybe HierarchyLevel
levelThree} -> Maybe HierarchyLevel
levelThree) (\s :: HierarchyStructure
s@HierarchyStructure' {} Maybe HierarchyLevel
a -> HierarchyStructure
s {$sel:levelThree:HierarchyStructure' :: Maybe HierarchyLevel
levelThree = Maybe HierarchyLevel
a} :: HierarchyStructure)

-- | Information about level four.
hierarchyStructure_levelFour :: Lens.Lens' HierarchyStructure (Prelude.Maybe HierarchyLevel)
hierarchyStructure_levelFour :: (Maybe HierarchyLevel -> f (Maybe HierarchyLevel))
-> HierarchyStructure -> f HierarchyStructure
hierarchyStructure_levelFour = (HierarchyStructure -> Maybe HierarchyLevel)
-> (HierarchyStructure
    -> Maybe HierarchyLevel -> HierarchyStructure)
-> Lens
     HierarchyStructure
     HierarchyStructure
     (Maybe HierarchyLevel)
     (Maybe HierarchyLevel)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HierarchyStructure' {Maybe HierarchyLevel
levelFour :: Maybe HierarchyLevel
$sel:levelFour:HierarchyStructure' :: HierarchyStructure -> Maybe HierarchyLevel
levelFour} -> Maybe HierarchyLevel
levelFour) (\s :: HierarchyStructure
s@HierarchyStructure' {} Maybe HierarchyLevel
a -> HierarchyStructure
s {$sel:levelFour:HierarchyStructure' :: Maybe HierarchyLevel
levelFour = Maybe HierarchyLevel
a} :: HierarchyStructure)

-- | Information about level two.
hierarchyStructure_levelTwo :: Lens.Lens' HierarchyStructure (Prelude.Maybe HierarchyLevel)
hierarchyStructure_levelTwo :: (Maybe HierarchyLevel -> f (Maybe HierarchyLevel))
-> HierarchyStructure -> f HierarchyStructure
hierarchyStructure_levelTwo = (HierarchyStructure -> Maybe HierarchyLevel)
-> (HierarchyStructure
    -> Maybe HierarchyLevel -> HierarchyStructure)
-> Lens
     HierarchyStructure
     HierarchyStructure
     (Maybe HierarchyLevel)
     (Maybe HierarchyLevel)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HierarchyStructure' {Maybe HierarchyLevel
levelTwo :: Maybe HierarchyLevel
$sel:levelTwo:HierarchyStructure' :: HierarchyStructure -> Maybe HierarchyLevel
levelTwo} -> Maybe HierarchyLevel
levelTwo) (\s :: HierarchyStructure
s@HierarchyStructure' {} Maybe HierarchyLevel
a -> HierarchyStructure
s {$sel:levelTwo:HierarchyStructure' :: Maybe HierarchyLevel
levelTwo = Maybe HierarchyLevel
a} :: HierarchyStructure)

-- | Information about level one.
hierarchyStructure_levelOne :: Lens.Lens' HierarchyStructure (Prelude.Maybe HierarchyLevel)
hierarchyStructure_levelOne :: (Maybe HierarchyLevel -> f (Maybe HierarchyLevel))
-> HierarchyStructure -> f HierarchyStructure
hierarchyStructure_levelOne = (HierarchyStructure -> Maybe HierarchyLevel)
-> (HierarchyStructure
    -> Maybe HierarchyLevel -> HierarchyStructure)
-> Lens
     HierarchyStructure
     HierarchyStructure
     (Maybe HierarchyLevel)
     (Maybe HierarchyLevel)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HierarchyStructure' {Maybe HierarchyLevel
levelOne :: Maybe HierarchyLevel
$sel:levelOne:HierarchyStructure' :: HierarchyStructure -> Maybe HierarchyLevel
levelOne} -> Maybe HierarchyLevel
levelOne) (\s :: HierarchyStructure
s@HierarchyStructure' {} Maybe HierarchyLevel
a -> HierarchyStructure
s {$sel:levelOne:HierarchyStructure' :: Maybe HierarchyLevel
levelOne = Maybe HierarchyLevel
a} :: HierarchyStructure)

instance Core.FromJSON HierarchyStructure where
  parseJSON :: Value -> Parser HierarchyStructure
parseJSON =
    String
-> (Object -> Parser HierarchyStructure)
-> Value
-> Parser HierarchyStructure
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"HierarchyStructure"
      ( \Object
x ->
          Maybe HierarchyLevel
-> Maybe HierarchyLevel
-> Maybe HierarchyLevel
-> Maybe HierarchyLevel
-> Maybe HierarchyLevel
-> HierarchyStructure
HierarchyStructure'
            (Maybe HierarchyLevel
 -> Maybe HierarchyLevel
 -> Maybe HierarchyLevel
 -> Maybe HierarchyLevel
 -> Maybe HierarchyLevel
 -> HierarchyStructure)
-> Parser (Maybe HierarchyLevel)
-> Parser
     (Maybe HierarchyLevel
      -> Maybe HierarchyLevel
      -> Maybe HierarchyLevel
      -> Maybe HierarchyLevel
      -> HierarchyStructure)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe HierarchyLevel)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LevelFive")
            Parser
  (Maybe HierarchyLevel
   -> Maybe HierarchyLevel
   -> Maybe HierarchyLevel
   -> Maybe HierarchyLevel
   -> HierarchyStructure)
-> Parser (Maybe HierarchyLevel)
-> Parser
     (Maybe HierarchyLevel
      -> Maybe HierarchyLevel
      -> Maybe HierarchyLevel
      -> HierarchyStructure)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe HierarchyLevel)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LevelThree")
            Parser
  (Maybe HierarchyLevel
   -> Maybe HierarchyLevel
   -> Maybe HierarchyLevel
   -> HierarchyStructure)
-> Parser (Maybe HierarchyLevel)
-> Parser
     (Maybe HierarchyLevel
      -> Maybe HierarchyLevel -> HierarchyStructure)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe HierarchyLevel)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LevelFour")
            Parser
  (Maybe HierarchyLevel
   -> Maybe HierarchyLevel -> HierarchyStructure)
-> Parser (Maybe HierarchyLevel)
-> Parser (Maybe HierarchyLevel -> HierarchyStructure)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe HierarchyLevel)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LevelTwo")
            Parser (Maybe HierarchyLevel -> HierarchyStructure)
-> Parser (Maybe HierarchyLevel) -> Parser HierarchyStructure
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe HierarchyLevel)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LevelOne")
      )

instance Prelude.Hashable HierarchyStructure

instance Prelude.NFData HierarchyStructure