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

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

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

-- |
-- Create a value of 'QueueReference' 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', 'queueReference_arn' - The Amazon Resource Name (ARN) of the queue.
--
-- 'id', 'queueReference_id' - The identifier of the queue.
newQueueReference ::
  QueueReference
newQueueReference :: QueueReference
newQueueReference =
  QueueReference' :: Maybe Text -> Maybe Text -> QueueReference
QueueReference'
    { $sel:arn:QueueReference' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:QueueReference' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

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

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

instance Core.FromJSON QueueReference where
  parseJSON :: Value -> Parser QueueReference
parseJSON =
    String
-> (Object -> Parser QueueReference)
-> Value
-> Parser QueueReference
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"QueueReference"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> QueueReference
QueueReference'
            (Maybe Text -> Maybe Text -> QueueReference)
-> Parser (Maybe Text) -> Parser (Maybe Text -> QueueReference)
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 -> QueueReference)
-> Parser (Maybe Text) -> Parser QueueReference
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 QueueReference

instance Prelude.NFData QueueReference