{-# 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.Pinpoint.Types.InAppMessagesResponse
-- 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.Pinpoint.Types.InAppMessagesResponse where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Pinpoint.Types.InAppMessageCampaign
import qualified Amazonka.Prelude as Prelude

-- | Get in-app messages response object.
--
-- /See:/ 'newInAppMessagesResponse' smart constructor.
data InAppMessagesResponse = InAppMessagesResponse'
  { -- | List of targeted in-app message campaigns.
    InAppMessagesResponse -> Maybe [InAppMessageCampaign]
inAppMessageCampaigns :: Prelude.Maybe [InAppMessageCampaign]
  }
  deriving (InAppMessagesResponse -> InAppMessagesResponse -> Bool
(InAppMessagesResponse -> InAppMessagesResponse -> Bool)
-> (InAppMessagesResponse -> InAppMessagesResponse -> Bool)
-> Eq InAppMessagesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InAppMessagesResponse -> InAppMessagesResponse -> Bool
$c/= :: InAppMessagesResponse -> InAppMessagesResponse -> Bool
== :: InAppMessagesResponse -> InAppMessagesResponse -> Bool
$c== :: InAppMessagesResponse -> InAppMessagesResponse -> Bool
Prelude.Eq, ReadPrec [InAppMessagesResponse]
ReadPrec InAppMessagesResponse
Int -> ReadS InAppMessagesResponse
ReadS [InAppMessagesResponse]
(Int -> ReadS InAppMessagesResponse)
-> ReadS [InAppMessagesResponse]
-> ReadPrec InAppMessagesResponse
-> ReadPrec [InAppMessagesResponse]
-> Read InAppMessagesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InAppMessagesResponse]
$creadListPrec :: ReadPrec [InAppMessagesResponse]
readPrec :: ReadPrec InAppMessagesResponse
$creadPrec :: ReadPrec InAppMessagesResponse
readList :: ReadS [InAppMessagesResponse]
$creadList :: ReadS [InAppMessagesResponse]
readsPrec :: Int -> ReadS InAppMessagesResponse
$creadsPrec :: Int -> ReadS InAppMessagesResponse
Prelude.Read, Int -> InAppMessagesResponse -> ShowS
[InAppMessagesResponse] -> ShowS
InAppMessagesResponse -> String
(Int -> InAppMessagesResponse -> ShowS)
-> (InAppMessagesResponse -> String)
-> ([InAppMessagesResponse] -> ShowS)
-> Show InAppMessagesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InAppMessagesResponse] -> ShowS
$cshowList :: [InAppMessagesResponse] -> ShowS
show :: InAppMessagesResponse -> String
$cshow :: InAppMessagesResponse -> String
showsPrec :: Int -> InAppMessagesResponse -> ShowS
$cshowsPrec :: Int -> InAppMessagesResponse -> ShowS
Prelude.Show, (forall x. InAppMessagesResponse -> Rep InAppMessagesResponse x)
-> (forall x. Rep InAppMessagesResponse x -> InAppMessagesResponse)
-> Generic InAppMessagesResponse
forall x. Rep InAppMessagesResponse x -> InAppMessagesResponse
forall x. InAppMessagesResponse -> Rep InAppMessagesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InAppMessagesResponse x -> InAppMessagesResponse
$cfrom :: forall x. InAppMessagesResponse -> Rep InAppMessagesResponse x
Prelude.Generic)

-- |
-- Create a value of 'InAppMessagesResponse' 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:
--
-- 'inAppMessageCampaigns', 'inAppMessagesResponse_inAppMessageCampaigns' - List of targeted in-app message campaigns.
newInAppMessagesResponse ::
  InAppMessagesResponse
newInAppMessagesResponse :: InAppMessagesResponse
newInAppMessagesResponse =
  InAppMessagesResponse' :: Maybe [InAppMessageCampaign] -> InAppMessagesResponse
InAppMessagesResponse'
    { $sel:inAppMessageCampaigns:InAppMessagesResponse' :: Maybe [InAppMessageCampaign]
inAppMessageCampaigns =
        Maybe [InAppMessageCampaign]
forall a. Maybe a
Prelude.Nothing
    }

-- | List of targeted in-app message campaigns.
inAppMessagesResponse_inAppMessageCampaigns :: Lens.Lens' InAppMessagesResponse (Prelude.Maybe [InAppMessageCampaign])
inAppMessagesResponse_inAppMessageCampaigns :: (Maybe [InAppMessageCampaign] -> f (Maybe [InAppMessageCampaign]))
-> InAppMessagesResponse -> f InAppMessagesResponse
inAppMessagesResponse_inAppMessageCampaigns = (InAppMessagesResponse -> Maybe [InAppMessageCampaign])
-> (InAppMessagesResponse
    -> Maybe [InAppMessageCampaign] -> InAppMessagesResponse)
-> Lens
     InAppMessagesResponse
     InAppMessagesResponse
     (Maybe [InAppMessageCampaign])
     (Maybe [InAppMessageCampaign])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InAppMessagesResponse' {Maybe [InAppMessageCampaign]
inAppMessageCampaigns :: Maybe [InAppMessageCampaign]
$sel:inAppMessageCampaigns:InAppMessagesResponse' :: InAppMessagesResponse -> Maybe [InAppMessageCampaign]
inAppMessageCampaigns} -> Maybe [InAppMessageCampaign]
inAppMessageCampaigns) (\s :: InAppMessagesResponse
s@InAppMessagesResponse' {} Maybe [InAppMessageCampaign]
a -> InAppMessagesResponse
s {$sel:inAppMessageCampaigns:InAppMessagesResponse' :: Maybe [InAppMessageCampaign]
inAppMessageCampaigns = Maybe [InAppMessageCampaign]
a} :: InAppMessagesResponse) ((Maybe [InAppMessageCampaign] -> f (Maybe [InAppMessageCampaign]))
 -> InAppMessagesResponse -> f InAppMessagesResponse)
-> ((Maybe [InAppMessageCampaign]
     -> f (Maybe [InAppMessageCampaign]))
    -> Maybe [InAppMessageCampaign]
    -> f (Maybe [InAppMessageCampaign]))
-> (Maybe [InAppMessageCampaign]
    -> f (Maybe [InAppMessageCampaign]))
-> InAppMessagesResponse
-> f InAppMessagesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [InAppMessageCampaign]
  [InAppMessageCampaign]
  [InAppMessageCampaign]
  [InAppMessageCampaign]
-> Iso
     (Maybe [InAppMessageCampaign])
     (Maybe [InAppMessageCampaign])
     (Maybe [InAppMessageCampaign])
     (Maybe [InAppMessageCampaign])
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
  [InAppMessageCampaign]
  [InAppMessageCampaign]
  [InAppMessageCampaign]
  [InAppMessageCampaign]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON InAppMessagesResponse where
  parseJSON :: Value -> Parser InAppMessagesResponse
parseJSON =
    String
-> (Object -> Parser InAppMessagesResponse)
-> Value
-> Parser InAppMessagesResponse
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"InAppMessagesResponse"
      ( \Object
x ->
          Maybe [InAppMessageCampaign] -> InAppMessagesResponse
InAppMessagesResponse'
            (Maybe [InAppMessageCampaign] -> InAppMessagesResponse)
-> Parser (Maybe [InAppMessageCampaign])
-> Parser InAppMessagesResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Parser (Maybe (Maybe [InAppMessageCampaign]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"InAppMessageCampaigns"
                            Parser (Maybe (Maybe [InAppMessageCampaign]))
-> Maybe [InAppMessageCampaign]
-> Parser (Maybe [InAppMessageCampaign])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [InAppMessageCampaign]
forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable InAppMessagesResponse

instance Prelude.NFData InAppMessagesResponse