{-# 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.AppFlow.Types.CustomerProfilesDestinationProperties
-- 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.AppFlow.Types.CustomerProfilesDestinationProperties where

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

-- | The properties that are applied when Amazon Connect Customer Profiles is
-- used as a destination.
--
-- /See:/ 'newCustomerProfilesDestinationProperties' smart constructor.
data CustomerProfilesDestinationProperties = CustomerProfilesDestinationProperties'
  { -- | The object specified in the Amazon Connect Customer Profiles flow
    -- destination.
    CustomerProfilesDestinationProperties -> Maybe Text
objectTypeName :: Prelude.Maybe Prelude.Text,
    -- | The unique name of the Amazon Connect Customer Profiles domain.
    CustomerProfilesDestinationProperties -> Text
domainName :: Prelude.Text
  }
  deriving (CustomerProfilesDestinationProperties
-> CustomerProfilesDestinationProperties -> Bool
(CustomerProfilesDestinationProperties
 -> CustomerProfilesDestinationProperties -> Bool)
-> (CustomerProfilesDestinationProperties
    -> CustomerProfilesDestinationProperties -> Bool)
-> Eq CustomerProfilesDestinationProperties
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CustomerProfilesDestinationProperties
-> CustomerProfilesDestinationProperties -> Bool
$c/= :: CustomerProfilesDestinationProperties
-> CustomerProfilesDestinationProperties -> Bool
== :: CustomerProfilesDestinationProperties
-> CustomerProfilesDestinationProperties -> Bool
$c== :: CustomerProfilesDestinationProperties
-> CustomerProfilesDestinationProperties -> Bool
Prelude.Eq, ReadPrec [CustomerProfilesDestinationProperties]
ReadPrec CustomerProfilesDestinationProperties
Int -> ReadS CustomerProfilesDestinationProperties
ReadS [CustomerProfilesDestinationProperties]
(Int -> ReadS CustomerProfilesDestinationProperties)
-> ReadS [CustomerProfilesDestinationProperties]
-> ReadPrec CustomerProfilesDestinationProperties
-> ReadPrec [CustomerProfilesDestinationProperties]
-> Read CustomerProfilesDestinationProperties
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CustomerProfilesDestinationProperties]
$creadListPrec :: ReadPrec [CustomerProfilesDestinationProperties]
readPrec :: ReadPrec CustomerProfilesDestinationProperties
$creadPrec :: ReadPrec CustomerProfilesDestinationProperties
readList :: ReadS [CustomerProfilesDestinationProperties]
$creadList :: ReadS [CustomerProfilesDestinationProperties]
readsPrec :: Int -> ReadS CustomerProfilesDestinationProperties
$creadsPrec :: Int -> ReadS CustomerProfilesDestinationProperties
Prelude.Read, Int -> CustomerProfilesDestinationProperties -> ShowS
[CustomerProfilesDestinationProperties] -> ShowS
CustomerProfilesDestinationProperties -> String
(Int -> CustomerProfilesDestinationProperties -> ShowS)
-> (CustomerProfilesDestinationProperties -> String)
-> ([CustomerProfilesDestinationProperties] -> ShowS)
-> Show CustomerProfilesDestinationProperties
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CustomerProfilesDestinationProperties] -> ShowS
$cshowList :: [CustomerProfilesDestinationProperties] -> ShowS
show :: CustomerProfilesDestinationProperties -> String
$cshow :: CustomerProfilesDestinationProperties -> String
showsPrec :: Int -> CustomerProfilesDestinationProperties -> ShowS
$cshowsPrec :: Int -> CustomerProfilesDestinationProperties -> ShowS
Prelude.Show, (forall x.
 CustomerProfilesDestinationProperties
 -> Rep CustomerProfilesDestinationProperties x)
-> (forall x.
    Rep CustomerProfilesDestinationProperties x
    -> CustomerProfilesDestinationProperties)
-> Generic CustomerProfilesDestinationProperties
forall x.
Rep CustomerProfilesDestinationProperties x
-> CustomerProfilesDestinationProperties
forall x.
CustomerProfilesDestinationProperties
-> Rep CustomerProfilesDestinationProperties x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CustomerProfilesDestinationProperties x
-> CustomerProfilesDestinationProperties
$cfrom :: forall x.
CustomerProfilesDestinationProperties
-> Rep CustomerProfilesDestinationProperties x
Prelude.Generic)

-- |
-- Create a value of 'CustomerProfilesDestinationProperties' 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:
--
-- 'objectTypeName', 'customerProfilesDestinationProperties_objectTypeName' - The object specified in the Amazon Connect Customer Profiles flow
-- destination.
--
-- 'domainName', 'customerProfilesDestinationProperties_domainName' - The unique name of the Amazon Connect Customer Profiles domain.
newCustomerProfilesDestinationProperties ::
  -- | 'domainName'
  Prelude.Text ->
  CustomerProfilesDestinationProperties
newCustomerProfilesDestinationProperties :: Text -> CustomerProfilesDestinationProperties
newCustomerProfilesDestinationProperties Text
pDomainName_ =
  CustomerProfilesDestinationProperties' :: Maybe Text -> Text -> CustomerProfilesDestinationProperties
CustomerProfilesDestinationProperties'
    { $sel:objectTypeName:CustomerProfilesDestinationProperties' :: Maybe Text
objectTypeName =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:domainName:CustomerProfilesDestinationProperties' :: Text
domainName = Text
pDomainName_
    }

-- | The object specified in the Amazon Connect Customer Profiles flow
-- destination.
customerProfilesDestinationProperties_objectTypeName :: Lens.Lens' CustomerProfilesDestinationProperties (Prelude.Maybe Prelude.Text)
customerProfilesDestinationProperties_objectTypeName :: (Maybe Text -> f (Maybe Text))
-> CustomerProfilesDestinationProperties
-> f CustomerProfilesDestinationProperties
customerProfilesDestinationProperties_objectTypeName = (CustomerProfilesDestinationProperties -> Maybe Text)
-> (CustomerProfilesDestinationProperties
    -> Maybe Text -> CustomerProfilesDestinationProperties)
-> Lens
     CustomerProfilesDestinationProperties
     CustomerProfilesDestinationProperties
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomerProfilesDestinationProperties' {Maybe Text
objectTypeName :: Maybe Text
$sel:objectTypeName:CustomerProfilesDestinationProperties' :: CustomerProfilesDestinationProperties -> Maybe Text
objectTypeName} -> Maybe Text
objectTypeName) (\s :: CustomerProfilesDestinationProperties
s@CustomerProfilesDestinationProperties' {} Maybe Text
a -> CustomerProfilesDestinationProperties
s {$sel:objectTypeName:CustomerProfilesDestinationProperties' :: Maybe Text
objectTypeName = Maybe Text
a} :: CustomerProfilesDestinationProperties)

-- | The unique name of the Amazon Connect Customer Profiles domain.
customerProfilesDestinationProperties_domainName :: Lens.Lens' CustomerProfilesDestinationProperties Prelude.Text
customerProfilesDestinationProperties_domainName :: (Text -> f Text)
-> CustomerProfilesDestinationProperties
-> f CustomerProfilesDestinationProperties
customerProfilesDestinationProperties_domainName = (CustomerProfilesDestinationProperties -> Text)
-> (CustomerProfilesDestinationProperties
    -> Text -> CustomerProfilesDestinationProperties)
-> Lens
     CustomerProfilesDestinationProperties
     CustomerProfilesDestinationProperties
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomerProfilesDestinationProperties' {Text
domainName :: Text
$sel:domainName:CustomerProfilesDestinationProperties' :: CustomerProfilesDestinationProperties -> Text
domainName} -> Text
domainName) (\s :: CustomerProfilesDestinationProperties
s@CustomerProfilesDestinationProperties' {} Text
a -> CustomerProfilesDestinationProperties
s {$sel:domainName:CustomerProfilesDestinationProperties' :: Text
domainName = Text
a} :: CustomerProfilesDestinationProperties)

instance
  Core.FromJSON
    CustomerProfilesDestinationProperties
  where
  parseJSON :: Value -> Parser CustomerProfilesDestinationProperties
parseJSON =
    String
-> (Object -> Parser CustomerProfilesDestinationProperties)
-> Value
-> Parser CustomerProfilesDestinationProperties
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"CustomerProfilesDestinationProperties"
      ( \Object
x ->
          Maybe Text -> Text -> CustomerProfilesDestinationProperties
CustomerProfilesDestinationProperties'
            (Maybe Text -> Text -> CustomerProfilesDestinationProperties)
-> Parser (Maybe Text)
-> Parser (Text -> CustomerProfilesDestinationProperties)
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
"objectTypeName")
            Parser (Text -> CustomerProfilesDestinationProperties)
-> Parser Text -> Parser CustomerProfilesDestinationProperties
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"domainName")
      )

instance
  Prelude.Hashable
    CustomerProfilesDestinationProperties

instance
  Prelude.NFData
    CustomerProfilesDestinationProperties

instance
  Core.ToJSON
    CustomerProfilesDestinationProperties
  where
  toJSON :: CustomerProfilesDestinationProperties -> Value
toJSON CustomerProfilesDestinationProperties' {Maybe Text
Text
domainName :: Text
objectTypeName :: Maybe Text
$sel:domainName:CustomerProfilesDestinationProperties' :: CustomerProfilesDestinationProperties -> Text
$sel:objectTypeName:CustomerProfilesDestinationProperties' :: CustomerProfilesDestinationProperties -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"objectTypeName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
objectTypeName,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"domainName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
domainName)
          ]
      )