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

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

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

-- |
-- Create a value of 'HierarchyGroup' 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', 'hierarchyGroup_arn' - The Amazon Resource Name (ARN) of the hierarchy group.
--
-- 'name', 'hierarchyGroup_name' - The name of the hierarchy group.
--
-- 'hierarchyPath', 'hierarchyGroup_hierarchyPath' - Information about the levels in the hierarchy group.
--
-- 'id', 'hierarchyGroup_id' - The identifier of the hierarchy group.
--
-- 'levelId', 'hierarchyGroup_levelId' - The identifier of the level in the hierarchy group.
newHierarchyGroup ::
  HierarchyGroup
newHierarchyGroup :: HierarchyGroup
newHierarchyGroup =
  HierarchyGroup' :: Maybe Text
-> Maybe Text
-> Maybe HierarchyPath
-> Maybe Text
-> Maybe Text
-> HierarchyGroup
HierarchyGroup'
    { $sel:arn:HierarchyGroup' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:HierarchyGroup' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:hierarchyPath:HierarchyGroup' :: Maybe HierarchyPath
hierarchyPath = Maybe HierarchyPath
forall a. Maybe a
Prelude.Nothing,
      $sel:id:HierarchyGroup' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:levelId:HierarchyGroup' :: Maybe Text
levelId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

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

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

-- | Information about the levels in the hierarchy group.
hierarchyGroup_hierarchyPath :: Lens.Lens' HierarchyGroup (Prelude.Maybe HierarchyPath)
hierarchyGroup_hierarchyPath :: (Maybe HierarchyPath -> f (Maybe HierarchyPath))
-> HierarchyGroup -> f HierarchyGroup
hierarchyGroup_hierarchyPath = (HierarchyGroup -> Maybe HierarchyPath)
-> (HierarchyGroup -> Maybe HierarchyPath -> HierarchyGroup)
-> Lens
     HierarchyGroup
     HierarchyGroup
     (Maybe HierarchyPath)
     (Maybe HierarchyPath)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HierarchyGroup' {Maybe HierarchyPath
hierarchyPath :: Maybe HierarchyPath
$sel:hierarchyPath:HierarchyGroup' :: HierarchyGroup -> Maybe HierarchyPath
hierarchyPath} -> Maybe HierarchyPath
hierarchyPath) (\s :: HierarchyGroup
s@HierarchyGroup' {} Maybe HierarchyPath
a -> HierarchyGroup
s {$sel:hierarchyPath:HierarchyGroup' :: Maybe HierarchyPath
hierarchyPath = Maybe HierarchyPath
a} :: HierarchyGroup)

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

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

instance Core.FromJSON HierarchyGroup where
  parseJSON :: Value -> Parser HierarchyGroup
parseJSON =
    String
-> (Object -> Parser HierarchyGroup)
-> Value
-> Parser HierarchyGroup
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"HierarchyGroup"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe HierarchyPath
-> Maybe Text
-> Maybe Text
-> HierarchyGroup
HierarchyGroup'
            (Maybe Text
 -> Maybe Text
 -> Maybe HierarchyPath
 -> Maybe Text
 -> Maybe Text
 -> HierarchyGroup)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe HierarchyPath
      -> Maybe Text
      -> Maybe Text
      -> HierarchyGroup)
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 HierarchyPath
   -> Maybe Text
   -> Maybe Text
   -> HierarchyGroup)
-> Parser (Maybe Text)
-> Parser
     (Maybe HierarchyPath -> Maybe Text -> Maybe Text -> HierarchyGroup)
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 HierarchyPath -> Maybe Text -> Maybe Text -> HierarchyGroup)
-> Parser (Maybe HierarchyPath)
-> Parser (Maybe Text -> Maybe Text -> HierarchyGroup)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe HierarchyPath)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"HierarchyPath")
            Parser (Maybe Text -> Maybe Text -> HierarchyGroup)
-> Parser (Maybe Text) -> Parser (Maybe Text -> HierarchyGroup)
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")
            Parser (Maybe Text -> HierarchyGroup)
-> Parser (Maybe Text) -> Parser HierarchyGroup
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
"LevelId")
      )

instance Prelude.Hashable HierarchyGroup

instance Prelude.NFData HierarchyGroup