{-# 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.ConnectCampaigns.Types.Campaign
-- 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.ConnectCampaigns.Types.Campaign where

import Amazonka.ConnectCampaigns.Types.DialerConfig
import Amazonka.ConnectCampaigns.Types.OutboundCallConfig
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

-- | An Amazon Connect campaign.
--
-- /See:/ 'newCampaign' smart constructor.
data Campaign = Campaign'
  { Campaign -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    Campaign -> Text
arn :: Prelude.Text,
    Campaign -> Text
connectInstanceId :: Prelude.Text,
    Campaign -> DialerConfig
dialerConfig :: DialerConfig,
    Campaign -> Text
id :: Prelude.Text,
    Campaign -> Text
name :: Prelude.Text,
    Campaign -> OutboundCallConfig
outboundCallConfig :: OutboundCallConfig
  }
  deriving (Campaign -> Campaign -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Campaign -> Campaign -> Bool
$c/= :: Campaign -> Campaign -> Bool
== :: Campaign -> Campaign -> Bool
$c== :: Campaign -> Campaign -> Bool
Prelude.Eq, ReadPrec [Campaign]
ReadPrec Campaign
Int -> ReadS Campaign
ReadS [Campaign]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Campaign]
$creadListPrec :: ReadPrec [Campaign]
readPrec :: ReadPrec Campaign
$creadPrec :: ReadPrec Campaign
readList :: ReadS [Campaign]
$creadList :: ReadS [Campaign]
readsPrec :: Int -> ReadS Campaign
$creadsPrec :: Int -> ReadS Campaign
Prelude.Read, Int -> Campaign -> ShowS
[Campaign] -> ShowS
Campaign -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Campaign] -> ShowS
$cshowList :: [Campaign] -> ShowS
show :: Campaign -> String
$cshow :: Campaign -> String
showsPrec :: Int -> Campaign -> ShowS
$cshowsPrec :: Int -> Campaign -> ShowS
Prelude.Show, forall x. Rep Campaign x -> Campaign
forall x. Campaign -> Rep Campaign x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Campaign x -> Campaign
$cfrom :: forall x. Campaign -> Rep Campaign x
Prelude.Generic)

-- |
-- Create a value of 'Campaign' 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:
--
-- 'tags', 'campaign_tags' - Undocumented member.
--
-- 'arn', 'campaign_arn' - Undocumented member.
--
-- 'connectInstanceId', 'campaign_connectInstanceId' - Undocumented member.
--
-- 'dialerConfig', 'campaign_dialerConfig' - Undocumented member.
--
-- 'id', 'campaign_id' - Undocumented member.
--
-- 'name', 'campaign_name' - Undocumented member.
--
-- 'outboundCallConfig', 'campaign_outboundCallConfig' - Undocumented member.
newCampaign ::
  -- | 'arn'
  Prelude.Text ->
  -- | 'connectInstanceId'
  Prelude.Text ->
  -- | 'dialerConfig'
  DialerConfig ->
  -- | 'id'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  -- | 'outboundCallConfig'
  OutboundCallConfig ->
  Campaign
newCampaign :: Text
-> Text
-> DialerConfig
-> Text
-> Text
-> OutboundCallConfig
-> Campaign
newCampaign
  Text
pArn_
  Text
pConnectInstanceId_
  DialerConfig
pDialerConfig_
  Text
pId_
  Text
pName_
  OutboundCallConfig
pOutboundCallConfig_ =
    Campaign'
      { $sel:tags:Campaign' :: Maybe (HashMap Text Text)
tags = forall a. Maybe a
Prelude.Nothing,
        $sel:arn:Campaign' :: Text
arn = Text
pArn_,
        $sel:connectInstanceId:Campaign' :: Text
connectInstanceId = Text
pConnectInstanceId_,
        $sel:dialerConfig:Campaign' :: DialerConfig
dialerConfig = DialerConfig
pDialerConfig_,
        $sel:id:Campaign' :: Text
id = Text
pId_,
        $sel:name:Campaign' :: Text
name = Text
pName_,
        $sel:outboundCallConfig:Campaign' :: OutboundCallConfig
outboundCallConfig = OutboundCallConfig
pOutboundCallConfig_
      }

-- | Undocumented member.
campaign_tags :: Lens.Lens' Campaign (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
campaign_tags :: Lens' Campaign (Maybe (HashMap Text Text))
campaign_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Campaign' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:Campaign' :: Campaign -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: Campaign
s@Campaign' {} Maybe (HashMap Text Text)
a -> Campaign
s {$sel:tags:Campaign' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: Campaign) 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

-- | Undocumented member.
campaign_arn :: Lens.Lens' Campaign Prelude.Text
campaign_arn :: Lens' Campaign Text
campaign_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Campaign' {Text
arn :: Text
$sel:arn:Campaign' :: Campaign -> Text
arn} -> Text
arn) (\s :: Campaign
s@Campaign' {} Text
a -> Campaign
s {$sel:arn:Campaign' :: Text
arn = Text
a} :: Campaign)

-- | Undocumented member.
campaign_connectInstanceId :: Lens.Lens' Campaign Prelude.Text
campaign_connectInstanceId :: Lens' Campaign Text
campaign_connectInstanceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Campaign' {Text
connectInstanceId :: Text
$sel:connectInstanceId:Campaign' :: Campaign -> Text
connectInstanceId} -> Text
connectInstanceId) (\s :: Campaign
s@Campaign' {} Text
a -> Campaign
s {$sel:connectInstanceId:Campaign' :: Text
connectInstanceId = Text
a} :: Campaign)

-- | Undocumented member.
campaign_dialerConfig :: Lens.Lens' Campaign DialerConfig
campaign_dialerConfig :: Lens' Campaign DialerConfig
campaign_dialerConfig = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Campaign' {DialerConfig
dialerConfig :: DialerConfig
$sel:dialerConfig:Campaign' :: Campaign -> DialerConfig
dialerConfig} -> DialerConfig
dialerConfig) (\s :: Campaign
s@Campaign' {} DialerConfig
a -> Campaign
s {$sel:dialerConfig:Campaign' :: DialerConfig
dialerConfig = DialerConfig
a} :: Campaign)

-- | Undocumented member.
campaign_id :: Lens.Lens' Campaign Prelude.Text
campaign_id :: Lens' Campaign Text
campaign_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Campaign' {Text
id :: Text
$sel:id:Campaign' :: Campaign -> Text
id} -> Text
id) (\s :: Campaign
s@Campaign' {} Text
a -> Campaign
s {$sel:id:Campaign' :: Text
id = Text
a} :: Campaign)

-- | Undocumented member.
campaign_name :: Lens.Lens' Campaign Prelude.Text
campaign_name :: Lens' Campaign Text
campaign_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Campaign' {Text
name :: Text
$sel:name:Campaign' :: Campaign -> Text
name} -> Text
name) (\s :: Campaign
s@Campaign' {} Text
a -> Campaign
s {$sel:name:Campaign' :: Text
name = Text
a} :: Campaign)

-- | Undocumented member.
campaign_outboundCallConfig :: Lens.Lens' Campaign OutboundCallConfig
campaign_outboundCallConfig :: Lens' Campaign OutboundCallConfig
campaign_outboundCallConfig = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Campaign' {OutboundCallConfig
outboundCallConfig :: OutboundCallConfig
$sel:outboundCallConfig:Campaign' :: Campaign -> OutboundCallConfig
outboundCallConfig} -> OutboundCallConfig
outboundCallConfig) (\s :: Campaign
s@Campaign' {} OutboundCallConfig
a -> Campaign
s {$sel:outboundCallConfig:Campaign' :: OutboundCallConfig
outboundCallConfig = OutboundCallConfig
a} :: Campaign)

instance Data.FromJSON Campaign where
  parseJSON :: Value -> Parser Campaign
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Campaign"
      ( \Object
x ->
          Maybe (HashMap Text Text)
-> Text
-> Text
-> DialerConfig
-> Text
-> Text
-> OutboundCallConfig
-> Campaign
Campaign'
            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
"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 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 a
Data..: Key
"connectInstanceId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"dialerConfig")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser 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 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 a
Data..: Key
"outboundCallConfig")
      )

instance Prelude.Hashable Campaign where
  hashWithSalt :: Int -> Campaign -> Int
hashWithSalt Int
_salt Campaign' {Maybe (HashMap Text Text)
Text
OutboundCallConfig
DialerConfig
outboundCallConfig :: OutboundCallConfig
name :: Text
id :: Text
dialerConfig :: DialerConfig
connectInstanceId :: Text
arn :: Text
tags :: Maybe (HashMap Text Text)
$sel:outboundCallConfig:Campaign' :: Campaign -> OutboundCallConfig
$sel:name:Campaign' :: Campaign -> Text
$sel:id:Campaign' :: Campaign -> Text
$sel:dialerConfig:Campaign' :: Campaign -> DialerConfig
$sel:connectInstanceId:Campaign' :: Campaign -> Text
$sel:arn:Campaign' :: Campaign -> Text
$sel:tags:Campaign' :: Campaign -> Maybe (HashMap Text Text)
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
connectInstanceId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` DialerConfig
dialerConfig
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` OutboundCallConfig
outboundCallConfig

instance Prelude.NFData Campaign where
  rnf :: Campaign -> ()
rnf Campaign' {Maybe (HashMap Text Text)
Text
OutboundCallConfig
DialerConfig
outboundCallConfig :: OutboundCallConfig
name :: Text
id :: Text
dialerConfig :: DialerConfig
connectInstanceId :: Text
arn :: Text
tags :: Maybe (HashMap Text Text)
$sel:outboundCallConfig:Campaign' :: Campaign -> OutboundCallConfig
$sel:name:Campaign' :: Campaign -> Text
$sel:id:Campaign' :: Campaign -> Text
$sel:dialerConfig:Campaign' :: Campaign -> DialerConfig
$sel:connectInstanceId:Campaign' :: Campaign -> Text
$sel:arn:Campaign' :: Campaign -> Text
$sel:tags:Campaign' :: Campaign -> Maybe (HashMap Text Text)
..} =
    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 Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
connectInstanceId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf DialerConfig
dialerConfig
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
id
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf OutboundCallConfig
outboundCallConfig