{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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,
    -- | 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,
    -- | The name of the hierarchy group.
    HierarchyGroup -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The tags used to organize, track, or control access for this resource.
    -- For example, { \"tags\": {\"key1\":\"value1\", \"key2\":\"value2\"} }.
    HierarchyGroup -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text)
  }
  deriving (HierarchyGroup -> HierarchyGroup -> Bool
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]
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
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. 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.
--
-- '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.
--
-- 'name', 'hierarchyGroup_name' - The name of the hierarchy group.
--
-- 'tags', 'hierarchyGroup_tags' - The tags used to organize, track, or control access for this resource.
-- For example, { \"tags\": {\"key1\":\"value1\", \"key2\":\"value2\"} }.
newHierarchyGroup ::
  HierarchyGroup
newHierarchyGroup :: HierarchyGroup
newHierarchyGroup =
  HierarchyGroup'
    { $sel:arn:HierarchyGroup' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:hierarchyPath:HierarchyGroup' :: Maybe HierarchyPath
hierarchyPath = forall a. Maybe a
Prelude.Nothing,
      $sel:id:HierarchyGroup' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing,
      $sel:levelId:HierarchyGroup' :: Maybe Text
levelId = forall a. Maybe a
Prelude.Nothing,
      $sel:name:HierarchyGroup' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:tags:HierarchyGroup' :: Maybe (HashMap Text Text)
tags = 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 :: Lens' HierarchyGroup (Maybe Text)
hierarchyGroup_arn = 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)

-- | Information about the levels in the hierarchy group.
hierarchyGroup_hierarchyPath :: Lens.Lens' HierarchyGroup (Prelude.Maybe HierarchyPath)
hierarchyGroup_hierarchyPath :: Lens' HierarchyGroup (Maybe HierarchyPath)
hierarchyGroup_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 :: Lens' HierarchyGroup (Maybe Text)
hierarchyGroup_id = 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 :: Lens' HierarchyGroup (Maybe Text)
hierarchyGroup_levelId = 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)

-- | The name of the hierarchy group.
hierarchyGroup_name :: Lens.Lens' HierarchyGroup (Prelude.Maybe Prelude.Text)
hierarchyGroup_name :: Lens' HierarchyGroup (Maybe Text)
hierarchyGroup_name = 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)

-- | The tags used to organize, track, or control access for this resource.
-- For example, { \"tags\": {\"key1\":\"value1\", \"key2\":\"value2\"} }.
hierarchyGroup_tags :: Lens.Lens' HierarchyGroup (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
hierarchyGroup_tags :: Lens' HierarchyGroup (Maybe (HashMap Text Text))
hierarchyGroup_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HierarchyGroup' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:HierarchyGroup' :: HierarchyGroup -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: HierarchyGroup
s@HierarchyGroup' {} Maybe (HashMap Text Text)
a -> HierarchyGroup
s {$sel:tags:HierarchyGroup' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: HierarchyGroup) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON HierarchyGroup where
  parseJSON :: Value -> Parser HierarchyGroup
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"HierarchyGroup"
      ( \Object
x ->
          Maybe Text
-> Maybe HierarchyPath
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> HierarchyGroup
HierarchyGroup'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Arn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"HierarchyPath")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Id")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"LevelId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Name")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Tags" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable HierarchyGroup where
  hashWithSalt :: Int -> HierarchyGroup -> Int
hashWithSalt Int
_salt HierarchyGroup' {Maybe Text
Maybe (HashMap Text Text)
Maybe HierarchyPath
tags :: Maybe (HashMap Text Text)
name :: Maybe Text
levelId :: Maybe Text
id :: Maybe Text
hierarchyPath :: Maybe HierarchyPath
arn :: Maybe Text
$sel:tags:HierarchyGroup' :: HierarchyGroup -> Maybe (HashMap Text Text)
$sel:name:HierarchyGroup' :: HierarchyGroup -> Maybe Text
$sel:levelId:HierarchyGroup' :: HierarchyGroup -> Maybe Text
$sel:id:HierarchyGroup' :: HierarchyGroup -> Maybe Text
$sel:hierarchyPath:HierarchyGroup' :: HierarchyGroup -> Maybe HierarchyPath
$sel:arn:HierarchyGroup' :: HierarchyGroup -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe HierarchyPath
hierarchyPath
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
levelId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
tags

instance Prelude.NFData HierarchyGroup where
  rnf :: HierarchyGroup -> ()
rnf HierarchyGroup' {Maybe Text
Maybe (HashMap Text Text)
Maybe HierarchyPath
tags :: Maybe (HashMap Text Text)
name :: Maybe Text
levelId :: Maybe Text
id :: Maybe Text
hierarchyPath :: Maybe HierarchyPath
arn :: Maybe Text
$sel:tags:HierarchyGroup' :: HierarchyGroup -> Maybe (HashMap Text Text)
$sel:name:HierarchyGroup' :: HierarchyGroup -> Maybe Text
$sel:levelId:HierarchyGroup' :: HierarchyGroup -> Maybe Text
$sel:id:HierarchyGroup' :: HierarchyGroup -> Maybe Text
$sel:hierarchyPath:HierarchyGroup' :: HierarchyGroup -> Maybe HierarchyPath
$sel:arn:HierarchyGroup' :: HierarchyGroup -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe HierarchyPath
hierarchyPath
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
id
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
levelId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
tags