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

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

-- | Contains information about a contact flow.
--
-- /See:/ 'newContactFlow' smart constructor.
data ContactFlow = ContactFlow'
  { -- | The Amazon Resource Name (ARN) of the contact flow.
    ContactFlow -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The content of the contact flow.
    ContactFlow -> Maybe Text
content :: Prelude.Maybe Prelude.Text,
    -- | The name of the contact flow.
    ContactFlow -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The identifier of the contact flow.
    ContactFlow -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The type of the contact flow. For descriptions of the available types,
    -- see
    -- <https://docs.aws.amazon.com/connect/latest/adminguide/create-contact-flow.html#contact-flow-types Choose a Contact Flow Type>
    -- in the /Amazon Connect Administrator Guide/.
    ContactFlow -> Maybe ContactFlowType
type' :: Prelude.Maybe ContactFlowType,
    -- | The description of the contact flow.
    ContactFlow -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | One or more tags.
    ContactFlow -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text)
  }
  deriving (ContactFlow -> ContactFlow -> Bool
(ContactFlow -> ContactFlow -> Bool)
-> (ContactFlow -> ContactFlow -> Bool) -> Eq ContactFlow
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ContactFlow -> ContactFlow -> Bool
$c/= :: ContactFlow -> ContactFlow -> Bool
== :: ContactFlow -> ContactFlow -> Bool
$c== :: ContactFlow -> ContactFlow -> Bool
Prelude.Eq, ReadPrec [ContactFlow]
ReadPrec ContactFlow
Int -> ReadS ContactFlow
ReadS [ContactFlow]
(Int -> ReadS ContactFlow)
-> ReadS [ContactFlow]
-> ReadPrec ContactFlow
-> ReadPrec [ContactFlow]
-> Read ContactFlow
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ContactFlow]
$creadListPrec :: ReadPrec [ContactFlow]
readPrec :: ReadPrec ContactFlow
$creadPrec :: ReadPrec ContactFlow
readList :: ReadS [ContactFlow]
$creadList :: ReadS [ContactFlow]
readsPrec :: Int -> ReadS ContactFlow
$creadsPrec :: Int -> ReadS ContactFlow
Prelude.Read, Int -> ContactFlow -> ShowS
[ContactFlow] -> ShowS
ContactFlow -> String
(Int -> ContactFlow -> ShowS)
-> (ContactFlow -> String)
-> ([ContactFlow] -> ShowS)
-> Show ContactFlow
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ContactFlow] -> ShowS
$cshowList :: [ContactFlow] -> ShowS
show :: ContactFlow -> String
$cshow :: ContactFlow -> String
showsPrec :: Int -> ContactFlow -> ShowS
$cshowsPrec :: Int -> ContactFlow -> ShowS
Prelude.Show, (forall x. ContactFlow -> Rep ContactFlow x)
-> (forall x. Rep ContactFlow x -> ContactFlow)
-> Generic ContactFlow
forall x. Rep ContactFlow x -> ContactFlow
forall x. ContactFlow -> Rep ContactFlow x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ContactFlow x -> ContactFlow
$cfrom :: forall x. ContactFlow -> Rep ContactFlow x
Prelude.Generic)

-- |
-- Create a value of 'ContactFlow' 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', 'contactFlow_arn' - The Amazon Resource Name (ARN) of the contact flow.
--
-- 'content', 'contactFlow_content' - The content of the contact flow.
--
-- 'name', 'contactFlow_name' - The name of the contact flow.
--
-- 'id', 'contactFlow_id' - The identifier of the contact flow.
--
-- 'type'', 'contactFlow_type' - The type of the contact flow. For descriptions of the available types,
-- see
-- <https://docs.aws.amazon.com/connect/latest/adminguide/create-contact-flow.html#contact-flow-types Choose a Contact Flow Type>
-- in the /Amazon Connect Administrator Guide/.
--
-- 'description', 'contactFlow_description' - The description of the contact flow.
--
-- 'tags', 'contactFlow_tags' - One or more tags.
newContactFlow ::
  ContactFlow
newContactFlow :: ContactFlow
newContactFlow =
  ContactFlow' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe ContactFlowType
-> Maybe Text
-> Maybe (HashMap Text Text)
-> ContactFlow
ContactFlow'
    { $sel:arn:ContactFlow' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:content:ContactFlow' :: Maybe Text
content = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:ContactFlow' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:ContactFlow' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:type':ContactFlow' :: Maybe ContactFlowType
type' = Maybe ContactFlowType
forall a. Maybe a
Prelude.Nothing,
      $sel:description:ContactFlow' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:ContactFlow' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing
    }

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

-- | The content of the contact flow.
contactFlow_content :: Lens.Lens' ContactFlow (Prelude.Maybe Prelude.Text)
contactFlow_content :: (Maybe Text -> f (Maybe Text)) -> ContactFlow -> f ContactFlow
contactFlow_content = (ContactFlow -> Maybe Text)
-> (ContactFlow -> Maybe Text -> ContactFlow)
-> Lens ContactFlow ContactFlow (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContactFlow' {Maybe Text
content :: Maybe Text
$sel:content:ContactFlow' :: ContactFlow -> Maybe Text
content} -> Maybe Text
content) (\s :: ContactFlow
s@ContactFlow' {} Maybe Text
a -> ContactFlow
s {$sel:content:ContactFlow' :: Maybe Text
content = Maybe Text
a} :: ContactFlow)

-- | The name of the contact flow.
contactFlow_name :: Lens.Lens' ContactFlow (Prelude.Maybe Prelude.Text)
contactFlow_name :: (Maybe Text -> f (Maybe Text)) -> ContactFlow -> f ContactFlow
contactFlow_name = (ContactFlow -> Maybe Text)
-> (ContactFlow -> Maybe Text -> ContactFlow)
-> Lens ContactFlow ContactFlow (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContactFlow' {Maybe Text
name :: Maybe Text
$sel:name:ContactFlow' :: ContactFlow -> Maybe Text
name} -> Maybe Text
name) (\s :: ContactFlow
s@ContactFlow' {} Maybe Text
a -> ContactFlow
s {$sel:name:ContactFlow' :: Maybe Text
name = Maybe Text
a} :: ContactFlow)

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

-- | The type of the contact flow. For descriptions of the available types,
-- see
-- <https://docs.aws.amazon.com/connect/latest/adminguide/create-contact-flow.html#contact-flow-types Choose a Contact Flow Type>
-- in the /Amazon Connect Administrator Guide/.
contactFlow_type :: Lens.Lens' ContactFlow (Prelude.Maybe ContactFlowType)
contactFlow_type :: (Maybe ContactFlowType -> f (Maybe ContactFlowType))
-> ContactFlow -> f ContactFlow
contactFlow_type = (ContactFlow -> Maybe ContactFlowType)
-> (ContactFlow -> Maybe ContactFlowType -> ContactFlow)
-> Lens
     ContactFlow
     ContactFlow
     (Maybe ContactFlowType)
     (Maybe ContactFlowType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContactFlow' {Maybe ContactFlowType
type' :: Maybe ContactFlowType
$sel:type':ContactFlow' :: ContactFlow -> Maybe ContactFlowType
type'} -> Maybe ContactFlowType
type') (\s :: ContactFlow
s@ContactFlow' {} Maybe ContactFlowType
a -> ContactFlow
s {$sel:type':ContactFlow' :: Maybe ContactFlowType
type' = Maybe ContactFlowType
a} :: ContactFlow)

-- | The description of the contact flow.
contactFlow_description :: Lens.Lens' ContactFlow (Prelude.Maybe Prelude.Text)
contactFlow_description :: (Maybe Text -> f (Maybe Text)) -> ContactFlow -> f ContactFlow
contactFlow_description = (ContactFlow -> Maybe Text)
-> (ContactFlow -> Maybe Text -> ContactFlow)
-> Lens ContactFlow ContactFlow (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContactFlow' {Maybe Text
description :: Maybe Text
$sel:description:ContactFlow' :: ContactFlow -> Maybe Text
description} -> Maybe Text
description) (\s :: ContactFlow
s@ContactFlow' {} Maybe Text
a -> ContactFlow
s {$sel:description:ContactFlow' :: Maybe Text
description = Maybe Text
a} :: ContactFlow)

-- | One or more tags.
contactFlow_tags :: Lens.Lens' ContactFlow (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
contactFlow_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ContactFlow -> f ContactFlow
contactFlow_tags = (ContactFlow -> Maybe (HashMap Text Text))
-> (ContactFlow -> Maybe (HashMap Text Text) -> ContactFlow)
-> Lens
     ContactFlow
     ContactFlow
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContactFlow' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:ContactFlow' :: ContactFlow -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: ContactFlow
s@ContactFlow' {} Maybe (HashMap Text Text)
a -> ContactFlow
s {$sel:tags:ContactFlow' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: ContactFlow) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> ContactFlow -> f ContactFlow)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ContactFlow
-> f ContactFlow
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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 AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON ContactFlow where
  parseJSON :: Value -> Parser ContactFlow
parseJSON =
    String
-> (Object -> Parser ContactFlow) -> Value -> Parser ContactFlow
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ContactFlow"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe ContactFlowType
-> Maybe Text
-> Maybe (HashMap Text Text)
-> ContactFlow
ContactFlow'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe ContactFlowType
 -> Maybe Text
 -> Maybe (HashMap Text Text)
 -> ContactFlow)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe ContactFlowType
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> ContactFlow)
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
   -> Maybe Text
   -> Maybe ContactFlowType
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> ContactFlow)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe ContactFlowType
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> ContactFlow)
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
"Content")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe ContactFlowType
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> ContactFlow)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe ContactFlowType
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> ContactFlow)
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
   -> Maybe ContactFlowType
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> ContactFlow)
-> Parser (Maybe Text)
-> Parser
     (Maybe ContactFlowType
      -> Maybe Text -> Maybe (HashMap Text Text) -> ContactFlow)
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 ContactFlowType
   -> Maybe Text -> Maybe (HashMap Text Text) -> ContactFlow)
-> Parser (Maybe ContactFlowType)
-> Parser (Maybe Text -> Maybe (HashMap Text Text) -> ContactFlow)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ContactFlowType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Type")
            Parser (Maybe Text -> Maybe (HashMap Text Text) -> ContactFlow)
-> Parser (Maybe Text)
-> Parser (Maybe (HashMap Text Text) -> ContactFlow)
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
"Description")
            Parser (Maybe (HashMap Text Text) -> ContactFlow)
-> Parser (Maybe (HashMap Text Text)) -> Parser ContactFlow
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Tags" Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable ContactFlow

instance Prelude.NFData ContactFlow