{-# 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.ApplicationsResponse
-- 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.ApplicationsResponse 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.ApplicationResponse
import qualified Amazonka.Prelude as Prelude

-- | Provides information about all of your applications.
--
-- /See:/ 'newApplicationsResponse' smart constructor.
data ApplicationsResponse = ApplicationsResponse'
  { -- | An array of responses, one for each application that was returned.
    ApplicationsResponse -> Maybe [ApplicationResponse]
item :: Prelude.Maybe [ApplicationResponse],
    -- | 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.
    ApplicationsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
  }
  deriving (ApplicationsResponse -> ApplicationsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ApplicationsResponse -> ApplicationsResponse -> Bool
$c/= :: ApplicationsResponse -> ApplicationsResponse -> Bool
== :: ApplicationsResponse -> ApplicationsResponse -> Bool
$c== :: ApplicationsResponse -> ApplicationsResponse -> Bool
Prelude.Eq, ReadPrec [ApplicationsResponse]
ReadPrec ApplicationsResponse
Int -> ReadS ApplicationsResponse
ReadS [ApplicationsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ApplicationsResponse]
$creadListPrec :: ReadPrec [ApplicationsResponse]
readPrec :: ReadPrec ApplicationsResponse
$creadPrec :: ReadPrec ApplicationsResponse
readList :: ReadS [ApplicationsResponse]
$creadList :: ReadS [ApplicationsResponse]
readsPrec :: Int -> ReadS ApplicationsResponse
$creadsPrec :: Int -> ReadS ApplicationsResponse
Prelude.Read, Int -> ApplicationsResponse -> ShowS
[ApplicationsResponse] -> ShowS
ApplicationsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ApplicationsResponse] -> ShowS
$cshowList :: [ApplicationsResponse] -> ShowS
show :: ApplicationsResponse -> String
$cshow :: ApplicationsResponse -> String
showsPrec :: Int -> ApplicationsResponse -> ShowS
$cshowsPrec :: Int -> ApplicationsResponse -> ShowS
Prelude.Show, forall x. Rep ApplicationsResponse x -> ApplicationsResponse
forall x. ApplicationsResponse -> Rep ApplicationsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ApplicationsResponse x -> ApplicationsResponse
$cfrom :: forall x. ApplicationsResponse -> Rep ApplicationsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ApplicationsResponse' 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:
--
-- 'item', 'applicationsResponse_item' - An array of responses, one for each application that was returned.
--
-- 'nextToken', 'applicationsResponse_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.
newApplicationsResponse ::
  ApplicationsResponse
newApplicationsResponse :: ApplicationsResponse
newApplicationsResponse =
  ApplicationsResponse'
    { $sel:item:ApplicationsResponse' :: Maybe [ApplicationResponse]
item = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ApplicationsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
    }

-- | An array of responses, one for each application that was returned.
applicationsResponse_item :: Lens.Lens' ApplicationsResponse (Prelude.Maybe [ApplicationResponse])
applicationsResponse_item :: Lens' ApplicationsResponse (Maybe [ApplicationResponse])
applicationsResponse_item = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApplicationsResponse' {Maybe [ApplicationResponse]
item :: Maybe [ApplicationResponse]
$sel:item:ApplicationsResponse' :: ApplicationsResponse -> Maybe [ApplicationResponse]
item} -> Maybe [ApplicationResponse]
item) (\s :: ApplicationsResponse
s@ApplicationsResponse' {} Maybe [ApplicationResponse]
a -> ApplicationsResponse
s {$sel:item:ApplicationsResponse' :: Maybe [ApplicationResponse]
item = Maybe [ApplicationResponse]
a} :: ApplicationsResponse) 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

-- | 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.
applicationsResponse_nextToken :: Lens.Lens' ApplicationsResponse (Prelude.Maybe Prelude.Text)
applicationsResponse_nextToken :: Lens' ApplicationsResponse (Maybe Text)
applicationsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApplicationsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ApplicationsResponse' :: ApplicationsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ApplicationsResponse
s@ApplicationsResponse' {} Maybe Text
a -> ApplicationsResponse
s {$sel:nextToken:ApplicationsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ApplicationsResponse)

instance Data.FromJSON ApplicationsResponse where
  parseJSON :: Value -> Parser ApplicationsResponse
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ApplicationsResponse"
      ( \Object
x ->
          Maybe [ApplicationResponse] -> Maybe Text -> ApplicationsResponse
ApplicationsResponse'
            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
"Item" 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 (Maybe a)
Data..:? Key
"NextToken")
      )

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

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