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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Pinpoint.Types.TemplateVersionResponse
import qualified Amazonka.Prelude as Prelude

-- | Provides information about all the versions of a specific message
-- template.
--
-- /See:/ 'newTemplateVersionsResponse' smart constructor.
data TemplateVersionsResponse = TemplateVersionsResponse'
  { -- | The message that\'s returned from the API for the request to retrieve
    -- information about all the versions of the message template.
    TemplateVersionsResponse -> Maybe Text
message :: Prelude.Maybe Prelude.Text,
    -- | The string to use in a subsequent request to get the next page of
    -- results in a paginated response. This value is null if there are no
    -- additional pages.
    TemplateVersionsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The unique identifier for the request to retrieve information about all
    -- the versions of the message template.
    TemplateVersionsResponse -> Maybe Text
requestID :: Prelude.Maybe Prelude.Text,
    -- | An array of responses, one for each version of the message template.
    TemplateVersionsResponse -> [TemplateVersionResponse]
item :: [TemplateVersionResponse]
  }
  deriving (TemplateVersionsResponse -> TemplateVersionsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TemplateVersionsResponse -> TemplateVersionsResponse -> Bool
$c/= :: TemplateVersionsResponse -> TemplateVersionsResponse -> Bool
== :: TemplateVersionsResponse -> TemplateVersionsResponse -> Bool
$c== :: TemplateVersionsResponse -> TemplateVersionsResponse -> Bool
Prelude.Eq, ReadPrec [TemplateVersionsResponse]
ReadPrec TemplateVersionsResponse
Int -> ReadS TemplateVersionsResponse
ReadS [TemplateVersionsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TemplateVersionsResponse]
$creadListPrec :: ReadPrec [TemplateVersionsResponse]
readPrec :: ReadPrec TemplateVersionsResponse
$creadPrec :: ReadPrec TemplateVersionsResponse
readList :: ReadS [TemplateVersionsResponse]
$creadList :: ReadS [TemplateVersionsResponse]
readsPrec :: Int -> ReadS TemplateVersionsResponse
$creadsPrec :: Int -> ReadS TemplateVersionsResponse
Prelude.Read, Int -> TemplateVersionsResponse -> ShowS
[TemplateVersionsResponse] -> ShowS
TemplateVersionsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TemplateVersionsResponse] -> ShowS
$cshowList :: [TemplateVersionsResponse] -> ShowS
show :: TemplateVersionsResponse -> String
$cshow :: TemplateVersionsResponse -> String
showsPrec :: Int -> TemplateVersionsResponse -> ShowS
$cshowsPrec :: Int -> TemplateVersionsResponse -> ShowS
Prelude.Show, forall x.
Rep TemplateVersionsResponse x -> TemplateVersionsResponse
forall x.
TemplateVersionsResponse -> Rep TemplateVersionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep TemplateVersionsResponse x -> TemplateVersionsResponse
$cfrom :: forall x.
TemplateVersionsResponse -> Rep TemplateVersionsResponse x
Prelude.Generic)

-- |
-- Create a value of 'TemplateVersionsResponse' 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:
--
-- 'message', 'templateVersionsResponse_message' - The message that\'s returned from the API for the request to retrieve
-- information about all the versions of the message template.
--
-- 'nextToken', 'templateVersionsResponse_nextToken' - The string to use in a subsequent request to get the next page of
-- results in a paginated response. This value is null if there are no
-- additional pages.
--
-- 'requestID', 'templateVersionsResponse_requestID' - The unique identifier for the request to retrieve information about all
-- the versions of the message template.
--
-- 'item', 'templateVersionsResponse_item' - An array of responses, one for each version of the message template.
newTemplateVersionsResponse ::
  TemplateVersionsResponse
newTemplateVersionsResponse :: TemplateVersionsResponse
newTemplateVersionsResponse =
  TemplateVersionsResponse'
    { $sel:message:TemplateVersionsResponse' :: Maybe Text
message =
        forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:TemplateVersionsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:requestID:TemplateVersionsResponse' :: Maybe Text
requestID = forall a. Maybe a
Prelude.Nothing,
      $sel:item:TemplateVersionsResponse' :: [TemplateVersionResponse]
item = forall a. Monoid a => a
Prelude.mempty
    }

-- | The message that\'s returned from the API for the request to retrieve
-- information about all the versions of the message template.
templateVersionsResponse_message :: Lens.Lens' TemplateVersionsResponse (Prelude.Maybe Prelude.Text)
templateVersionsResponse_message :: Lens' TemplateVersionsResponse (Maybe Text)
templateVersionsResponse_message = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TemplateVersionsResponse' {Maybe Text
message :: Maybe Text
$sel:message:TemplateVersionsResponse' :: TemplateVersionsResponse -> Maybe Text
message} -> Maybe Text
message) (\s :: TemplateVersionsResponse
s@TemplateVersionsResponse' {} Maybe Text
a -> TemplateVersionsResponse
s {$sel:message:TemplateVersionsResponse' :: Maybe Text
message = Maybe Text
a} :: TemplateVersionsResponse)

-- | The string to use in a subsequent request to get the next page of
-- results in a paginated response. This value is null if there are no
-- additional pages.
templateVersionsResponse_nextToken :: Lens.Lens' TemplateVersionsResponse (Prelude.Maybe Prelude.Text)
templateVersionsResponse_nextToken :: Lens' TemplateVersionsResponse (Maybe Text)
templateVersionsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TemplateVersionsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:TemplateVersionsResponse' :: TemplateVersionsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: TemplateVersionsResponse
s@TemplateVersionsResponse' {} Maybe Text
a -> TemplateVersionsResponse
s {$sel:nextToken:TemplateVersionsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: TemplateVersionsResponse)

-- | The unique identifier for the request to retrieve information about all
-- the versions of the message template.
templateVersionsResponse_requestID :: Lens.Lens' TemplateVersionsResponse (Prelude.Maybe Prelude.Text)
templateVersionsResponse_requestID :: Lens' TemplateVersionsResponse (Maybe Text)
templateVersionsResponse_requestID = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TemplateVersionsResponse' {Maybe Text
requestID :: Maybe Text
$sel:requestID:TemplateVersionsResponse' :: TemplateVersionsResponse -> Maybe Text
requestID} -> Maybe Text
requestID) (\s :: TemplateVersionsResponse
s@TemplateVersionsResponse' {} Maybe Text
a -> TemplateVersionsResponse
s {$sel:requestID:TemplateVersionsResponse' :: Maybe Text
requestID = Maybe Text
a} :: TemplateVersionsResponse)

-- | An array of responses, one for each version of the message template.
templateVersionsResponse_item :: Lens.Lens' TemplateVersionsResponse [TemplateVersionResponse]
templateVersionsResponse_item :: Lens' TemplateVersionsResponse [TemplateVersionResponse]
templateVersionsResponse_item = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TemplateVersionsResponse' {[TemplateVersionResponse]
item :: [TemplateVersionResponse]
$sel:item:TemplateVersionsResponse' :: TemplateVersionsResponse -> [TemplateVersionResponse]
item} -> [TemplateVersionResponse]
item) (\s :: TemplateVersionsResponse
s@TemplateVersionsResponse' {} [TemplateVersionResponse]
a -> TemplateVersionsResponse
s {$sel:item:TemplateVersionsResponse' :: [TemplateVersionResponse]
item = [TemplateVersionResponse]
a} :: TemplateVersionsResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON TemplateVersionsResponse where
  parseJSON :: Value -> Parser TemplateVersionsResponse
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"TemplateVersionsResponse"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> [TemplateVersionResponse]
-> TemplateVersionsResponse
TemplateVersionsResponse'
            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
"Message")
            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
"NextToken")
            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
"RequestID")
            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
"Item" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable TemplateVersionsResponse where
  hashWithSalt :: Int -> TemplateVersionsResponse -> Int
hashWithSalt Int
_salt TemplateVersionsResponse' {[TemplateVersionResponse]
Maybe Text
item :: [TemplateVersionResponse]
requestID :: Maybe Text
nextToken :: Maybe Text
message :: Maybe Text
$sel:item:TemplateVersionsResponse' :: TemplateVersionsResponse -> [TemplateVersionResponse]
$sel:requestID:TemplateVersionsResponse' :: TemplateVersionsResponse -> Maybe Text
$sel:nextToken:TemplateVersionsResponse' :: TemplateVersionsResponse -> Maybe Text
$sel:message:TemplateVersionsResponse' :: TemplateVersionsResponse -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
message
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
requestID
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [TemplateVersionResponse]
item

instance Prelude.NFData TemplateVersionsResponse where
  rnf :: TemplateVersionsResponse -> ()
rnf TemplateVersionsResponse' {[TemplateVersionResponse]
Maybe Text
item :: [TemplateVersionResponse]
requestID :: Maybe Text
nextToken :: Maybe Text
message :: Maybe Text
$sel:item:TemplateVersionsResponse' :: TemplateVersionsResponse -> [TemplateVersionResponse]
$sel:requestID:TemplateVersionsResponse' :: TemplateVersionsResponse -> Maybe Text
$sel:nextToken:TemplateVersionsResponse' :: TemplateVersionsResponse -> Maybe Text
$sel:message:TemplateVersionsResponse' :: TemplateVersionsResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
message
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
requestID
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [TemplateVersionResponse]
item