{-# 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.SESV2.Types.ImportDestination
-- 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.SESV2.Types.ImportDestination where

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
import Amazonka.SESV2.Types.ContactListDestination
import Amazonka.SESV2.Types.SuppressionListDestination

-- | An object that contains details about the resource destination the
-- import job is going to target.
--
-- /See:/ 'newImportDestination' smart constructor.
data ImportDestination = ImportDestination'
  { -- | An object that contains the action of the import job towards a contact
    -- list.
    ImportDestination -> Maybe ContactListDestination
contactListDestination :: Prelude.Maybe ContactListDestination,
    -- | An object that contains the action of the import job towards suppression
    -- list.
    ImportDestination -> Maybe SuppressionListDestination
suppressionListDestination :: Prelude.Maybe SuppressionListDestination
  }
  deriving (ImportDestination -> ImportDestination -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ImportDestination -> ImportDestination -> Bool
$c/= :: ImportDestination -> ImportDestination -> Bool
== :: ImportDestination -> ImportDestination -> Bool
$c== :: ImportDestination -> ImportDestination -> Bool
Prelude.Eq, ReadPrec [ImportDestination]
ReadPrec ImportDestination
Int -> ReadS ImportDestination
ReadS [ImportDestination]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ImportDestination]
$creadListPrec :: ReadPrec [ImportDestination]
readPrec :: ReadPrec ImportDestination
$creadPrec :: ReadPrec ImportDestination
readList :: ReadS [ImportDestination]
$creadList :: ReadS [ImportDestination]
readsPrec :: Int -> ReadS ImportDestination
$creadsPrec :: Int -> ReadS ImportDestination
Prelude.Read, Int -> ImportDestination -> ShowS
[ImportDestination] -> ShowS
ImportDestination -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ImportDestination] -> ShowS
$cshowList :: [ImportDestination] -> ShowS
show :: ImportDestination -> String
$cshow :: ImportDestination -> String
showsPrec :: Int -> ImportDestination -> ShowS
$cshowsPrec :: Int -> ImportDestination -> ShowS
Prelude.Show, forall x. Rep ImportDestination x -> ImportDestination
forall x. ImportDestination -> Rep ImportDestination x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ImportDestination x -> ImportDestination
$cfrom :: forall x. ImportDestination -> Rep ImportDestination x
Prelude.Generic)

-- |
-- Create a value of 'ImportDestination' 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:
--
-- 'contactListDestination', 'importDestination_contactListDestination' - An object that contains the action of the import job towards a contact
-- list.
--
-- 'suppressionListDestination', 'importDestination_suppressionListDestination' - An object that contains the action of the import job towards suppression
-- list.
newImportDestination ::
  ImportDestination
newImportDestination :: ImportDestination
newImportDestination =
  ImportDestination'
    { $sel:contactListDestination:ImportDestination' :: Maybe ContactListDestination
contactListDestination =
        forall a. Maybe a
Prelude.Nothing,
      $sel:suppressionListDestination:ImportDestination' :: Maybe SuppressionListDestination
suppressionListDestination = forall a. Maybe a
Prelude.Nothing
    }

-- | An object that contains the action of the import job towards a contact
-- list.
importDestination_contactListDestination :: Lens.Lens' ImportDestination (Prelude.Maybe ContactListDestination)
importDestination_contactListDestination :: Lens' ImportDestination (Maybe ContactListDestination)
importDestination_contactListDestination = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportDestination' {Maybe ContactListDestination
contactListDestination :: Maybe ContactListDestination
$sel:contactListDestination:ImportDestination' :: ImportDestination -> Maybe ContactListDestination
contactListDestination} -> Maybe ContactListDestination
contactListDestination) (\s :: ImportDestination
s@ImportDestination' {} Maybe ContactListDestination
a -> ImportDestination
s {$sel:contactListDestination:ImportDestination' :: Maybe ContactListDestination
contactListDestination = Maybe ContactListDestination
a} :: ImportDestination)

-- | An object that contains the action of the import job towards suppression
-- list.
importDestination_suppressionListDestination :: Lens.Lens' ImportDestination (Prelude.Maybe SuppressionListDestination)
importDestination_suppressionListDestination :: Lens' ImportDestination (Maybe SuppressionListDestination)
importDestination_suppressionListDestination = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportDestination' {Maybe SuppressionListDestination
suppressionListDestination :: Maybe SuppressionListDestination
$sel:suppressionListDestination:ImportDestination' :: ImportDestination -> Maybe SuppressionListDestination
suppressionListDestination} -> Maybe SuppressionListDestination
suppressionListDestination) (\s :: ImportDestination
s@ImportDestination' {} Maybe SuppressionListDestination
a -> ImportDestination
s {$sel:suppressionListDestination:ImportDestination' :: Maybe SuppressionListDestination
suppressionListDestination = Maybe SuppressionListDestination
a} :: ImportDestination)

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

instance Prelude.Hashable ImportDestination where
  hashWithSalt :: Int -> ImportDestination -> Int
hashWithSalt Int
_salt ImportDestination' {Maybe ContactListDestination
Maybe SuppressionListDestination
suppressionListDestination :: Maybe SuppressionListDestination
contactListDestination :: Maybe ContactListDestination
$sel:suppressionListDestination:ImportDestination' :: ImportDestination -> Maybe SuppressionListDestination
$sel:contactListDestination:ImportDestination' :: ImportDestination -> Maybe ContactListDestination
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ContactListDestination
contactListDestination
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SuppressionListDestination
suppressionListDestination

instance Prelude.NFData ImportDestination where
  rnf :: ImportDestination -> ()
rnf ImportDestination' {Maybe ContactListDestination
Maybe SuppressionListDestination
suppressionListDestination :: Maybe SuppressionListDestination
contactListDestination :: Maybe ContactListDestination
$sel:suppressionListDestination:ImportDestination' :: ImportDestination -> Maybe SuppressionListDestination
$sel:contactListDestination:ImportDestination' :: ImportDestination -> Maybe ContactListDestination
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ContactListDestination
contactListDestination
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe SuppressionListDestination
suppressionListDestination

instance Data.ToJSON ImportDestination where
  toJSON :: ImportDestination -> Value
toJSON ImportDestination' {Maybe ContactListDestination
Maybe SuppressionListDestination
suppressionListDestination :: Maybe SuppressionListDestination
contactListDestination :: Maybe ContactListDestination
$sel:suppressionListDestination:ImportDestination' :: ImportDestination -> Maybe SuppressionListDestination
$sel:contactListDestination:ImportDestination' :: ImportDestination -> Maybe ContactListDestination
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"ContactListDestination" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ContactListDestination
contactListDestination,
            (Key
"SuppressionListDestination" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SuppressionListDestination
suppressionListDestination
          ]
      )