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

import Amazonka.Connect.Types.ContactFlowState
import Amazonka.Connect.Types.ContactFlowType
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 flow.
--
-- /See:/ 'newContactFlow' smart constructor.
data ContactFlow = ContactFlow'
  { -- | The Amazon Resource Name (ARN) of the flow.
    ContactFlow -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The content of the flow.
    ContactFlow -> Maybe Text
content :: Prelude.Maybe Prelude.Text,
    -- | The description of the flow.
    ContactFlow -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The identifier of the flow.
    ContactFlow -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The name of the flow.
    ContactFlow -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The type of flow.
    ContactFlow -> Maybe ContactFlowState
state :: Prelude.Maybe ContactFlowState,
    -- | The tags used to organize, track, or control access for this resource.
    -- For example, { \"tags\": {\"key1\":\"value1\", \"key2\":\"value2\"} }.
    ContactFlow -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The type of the 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 flow type>
    -- in the /Amazon Connect Administrator Guide/.
    ContactFlow -> Maybe ContactFlowType
type' :: Prelude.Maybe ContactFlowType
  }
  deriving (ContactFlow -> ContactFlow -> Bool
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]
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
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. 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 flow.
--
-- 'content', 'contactFlow_content' - The content of the flow.
--
-- 'description', 'contactFlow_description' - The description of the flow.
--
-- 'id', 'contactFlow_id' - The identifier of the flow.
--
-- 'name', 'contactFlow_name' - The name of the flow.
--
-- 'state', 'contactFlow_state' - The type of flow.
--
-- 'tags', 'contactFlow_tags' - The tags used to organize, track, or control access for this resource.
-- For example, { \"tags\": {\"key1\":\"value1\", \"key2\":\"value2\"} }.
--
-- 'type'', 'contactFlow_type' - The type of the 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 flow type>
-- in the /Amazon Connect Administrator Guide/.
newContactFlow ::
  ContactFlow
newContactFlow :: ContactFlow
newContactFlow =
  ContactFlow'
    { $sel:arn:ContactFlow' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:content:ContactFlow' :: Maybe Text
content = forall a. Maybe a
Prelude.Nothing,
      $sel:description:ContactFlow' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:id:ContactFlow' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing,
      $sel:name:ContactFlow' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:state:ContactFlow' :: Maybe ContactFlowState
state = forall a. Maybe a
Prelude.Nothing,
      $sel:tags:ContactFlow' :: Maybe (HashMap Text Text)
tags = forall a. Maybe a
Prelude.Nothing,
      $sel:type':ContactFlow' :: Maybe ContactFlowType
type' = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) of the flow.
contactFlow_arn :: Lens.Lens' ContactFlow (Prelude.Maybe Prelude.Text)
contactFlow_arn :: Lens' ContactFlow (Maybe Text)
contactFlow_arn = 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 flow.
contactFlow_content :: Lens.Lens' ContactFlow (Prelude.Maybe Prelude.Text)
contactFlow_content :: Lens' ContactFlow (Maybe Text)
contactFlow_content = 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 description of the flow.
contactFlow_description :: Lens.Lens' ContactFlow (Prelude.Maybe Prelude.Text)
contactFlow_description :: Lens' ContactFlow (Maybe Text)
contactFlow_description = 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)

-- | The identifier of the flow.
contactFlow_id :: Lens.Lens' ContactFlow (Prelude.Maybe Prelude.Text)
contactFlow_id :: Lens' ContactFlow (Maybe Text)
contactFlow_id = 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 name of the flow.
contactFlow_name :: Lens.Lens' ContactFlow (Prelude.Maybe Prelude.Text)
contactFlow_name :: Lens' ContactFlow (Maybe Text)
contactFlow_name = 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 type of flow.
contactFlow_state :: Lens.Lens' ContactFlow (Prelude.Maybe ContactFlowState)
contactFlow_state :: Lens' ContactFlow (Maybe ContactFlowState)
contactFlow_state = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContactFlow' {Maybe ContactFlowState
state :: Maybe ContactFlowState
$sel:state:ContactFlow' :: ContactFlow -> Maybe ContactFlowState
state} -> Maybe ContactFlowState
state) (\s :: ContactFlow
s@ContactFlow' {} Maybe ContactFlowState
a -> ContactFlow
s {$sel:state:ContactFlow' :: Maybe ContactFlowState
state = Maybe ContactFlowState
a} :: ContactFlow)

-- | The tags used to organize, track, or control access for this resource.
-- For example, { \"tags\": {\"key1\":\"value1\", \"key2\":\"value2\"} }.
contactFlow_tags :: Lens.Lens' ContactFlow (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
contactFlow_tags :: Lens' ContactFlow (Maybe (HashMap Text Text))
contactFlow_tags = 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) 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

-- | The type of the 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 flow type>
-- in the /Amazon Connect Administrator Guide/.
contactFlow_type :: Lens.Lens' ContactFlow (Prelude.Maybe ContactFlowType)
contactFlow_type :: Lens' ContactFlow (Maybe ContactFlowType)
contactFlow_type = 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)

instance Data.FromJSON ContactFlow where
  parseJSON :: Value -> Parser ContactFlow
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ContactFlow"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe ContactFlowState
-> Maybe (HashMap Text Text)
-> Maybe ContactFlowType
-> ContactFlow
ContactFlow'
            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
"Content")
            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
"Description")
            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
"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
"State")
            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)
            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
"Type")
      )

instance Prelude.Hashable ContactFlow where
  hashWithSalt :: Int -> ContactFlow -> Int
hashWithSalt Int
_salt ContactFlow' {Maybe Text
Maybe (HashMap Text Text)
Maybe ContactFlowState
Maybe ContactFlowType
type' :: Maybe ContactFlowType
tags :: Maybe (HashMap Text Text)
state :: Maybe ContactFlowState
name :: Maybe Text
id :: Maybe Text
description :: Maybe Text
content :: Maybe Text
arn :: Maybe Text
$sel:type':ContactFlow' :: ContactFlow -> Maybe ContactFlowType
$sel:tags:ContactFlow' :: ContactFlow -> Maybe (HashMap Text Text)
$sel:state:ContactFlow' :: ContactFlow -> Maybe ContactFlowState
$sel:name:ContactFlow' :: ContactFlow -> Maybe Text
$sel:id:ContactFlow' :: ContactFlow -> Maybe Text
$sel:description:ContactFlow' :: ContactFlow -> Maybe Text
$sel:content:ContactFlow' :: ContactFlow -> Maybe Text
$sel:arn:ContactFlow' :: ContactFlow -> 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 Text
content
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ContactFlowState
state
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ContactFlowType
type'

instance Prelude.NFData ContactFlow where
  rnf :: ContactFlow -> ()
rnf ContactFlow' {Maybe Text
Maybe (HashMap Text Text)
Maybe ContactFlowState
Maybe ContactFlowType
type' :: Maybe ContactFlowType
tags :: Maybe (HashMap Text Text)
state :: Maybe ContactFlowState
name :: Maybe Text
id :: Maybe Text
description :: Maybe Text
content :: Maybe Text
arn :: Maybe Text
$sel:type':ContactFlow' :: ContactFlow -> Maybe ContactFlowType
$sel:tags:ContactFlow' :: ContactFlow -> Maybe (HashMap Text Text)
$sel:state:ContactFlow' :: ContactFlow -> Maybe ContactFlowState
$sel:name:ContactFlow' :: ContactFlow -> Maybe Text
$sel:id:ContactFlow' :: ContactFlow -> Maybe Text
$sel:description:ContactFlow' :: ContactFlow -> Maybe Text
$sel:content:ContactFlow' :: ContactFlow -> Maybe Text
$sel:arn:ContactFlow' :: ContactFlow -> 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 Text
content
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      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
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ContactFlowState
state
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ContactFlowType
type'