{-# 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.ImportJobsResponse
-- 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.ImportJobsResponse where

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

-- | Provides information about the status and settings of all the import
-- jobs that are associated with an application or segment. An import job
-- is a job that imports endpoint definitions from one or more files.
--
-- /See:/ 'newImportJobsResponse' smart constructor.
data ImportJobsResponse = ImportJobsResponse'
  { -- | 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.
    ImportJobsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | An array of responses, one for each import job that\'s associated with
    -- the application (Import Jobs resource) or segment (Segment Import Jobs
    -- resource).
    ImportJobsResponse -> [ImportJobResponse]
item :: [ImportJobResponse]
  }
  deriving (ImportJobsResponse -> ImportJobsResponse -> Bool
(ImportJobsResponse -> ImportJobsResponse -> Bool)
-> (ImportJobsResponse -> ImportJobsResponse -> Bool)
-> Eq ImportJobsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ImportJobsResponse -> ImportJobsResponse -> Bool
$c/= :: ImportJobsResponse -> ImportJobsResponse -> Bool
== :: ImportJobsResponse -> ImportJobsResponse -> Bool
$c== :: ImportJobsResponse -> ImportJobsResponse -> Bool
Prelude.Eq, ReadPrec [ImportJobsResponse]
ReadPrec ImportJobsResponse
Int -> ReadS ImportJobsResponse
ReadS [ImportJobsResponse]
(Int -> ReadS ImportJobsResponse)
-> ReadS [ImportJobsResponse]
-> ReadPrec ImportJobsResponse
-> ReadPrec [ImportJobsResponse]
-> Read ImportJobsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ImportJobsResponse]
$creadListPrec :: ReadPrec [ImportJobsResponse]
readPrec :: ReadPrec ImportJobsResponse
$creadPrec :: ReadPrec ImportJobsResponse
readList :: ReadS [ImportJobsResponse]
$creadList :: ReadS [ImportJobsResponse]
readsPrec :: Int -> ReadS ImportJobsResponse
$creadsPrec :: Int -> ReadS ImportJobsResponse
Prelude.Read, Int -> ImportJobsResponse -> ShowS
[ImportJobsResponse] -> ShowS
ImportJobsResponse -> String
(Int -> ImportJobsResponse -> ShowS)
-> (ImportJobsResponse -> String)
-> ([ImportJobsResponse] -> ShowS)
-> Show ImportJobsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ImportJobsResponse] -> ShowS
$cshowList :: [ImportJobsResponse] -> ShowS
show :: ImportJobsResponse -> String
$cshow :: ImportJobsResponse -> String
showsPrec :: Int -> ImportJobsResponse -> ShowS
$cshowsPrec :: Int -> ImportJobsResponse -> ShowS
Prelude.Show, (forall x. ImportJobsResponse -> Rep ImportJobsResponse x)
-> (forall x. Rep ImportJobsResponse x -> ImportJobsResponse)
-> Generic ImportJobsResponse
forall x. Rep ImportJobsResponse x -> ImportJobsResponse
forall x. ImportJobsResponse -> Rep ImportJobsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ImportJobsResponse x -> ImportJobsResponse
$cfrom :: forall x. ImportJobsResponse -> Rep ImportJobsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ImportJobsResponse' 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:
--
-- 'nextToken', 'importJobsResponse_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.
--
-- 'item', 'importJobsResponse_item' - An array of responses, one for each import job that\'s associated with
-- the application (Import Jobs resource) or segment (Segment Import Jobs
-- resource).
newImportJobsResponse ::
  ImportJobsResponse
newImportJobsResponse :: ImportJobsResponse
newImportJobsResponse =
  ImportJobsResponse' :: Maybe Text -> [ImportJobResponse] -> ImportJobsResponse
ImportJobsResponse'
    { $sel:nextToken:ImportJobsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:item:ImportJobsResponse' :: [ImportJobResponse]
item = [ImportJobResponse]
forall a. Monoid a => a
Prelude.mempty
    }

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

-- | An array of responses, one for each import job that\'s associated with
-- the application (Import Jobs resource) or segment (Segment Import Jobs
-- resource).
importJobsResponse_item :: Lens.Lens' ImportJobsResponse [ImportJobResponse]
importJobsResponse_item :: ([ImportJobResponse] -> f [ImportJobResponse])
-> ImportJobsResponse -> f ImportJobsResponse
importJobsResponse_item = (ImportJobsResponse -> [ImportJobResponse])
-> (ImportJobsResponse
    -> [ImportJobResponse] -> ImportJobsResponse)
-> Lens
     ImportJobsResponse
     ImportJobsResponse
     [ImportJobResponse]
     [ImportJobResponse]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportJobsResponse' {[ImportJobResponse]
item :: [ImportJobResponse]
$sel:item:ImportJobsResponse' :: ImportJobsResponse -> [ImportJobResponse]
item} -> [ImportJobResponse]
item) (\s :: ImportJobsResponse
s@ImportJobsResponse' {} [ImportJobResponse]
a -> ImportJobsResponse
s {$sel:item:ImportJobsResponse' :: [ImportJobResponse]
item = [ImportJobResponse]
a} :: ImportJobsResponse) (([ImportJobResponse] -> f [ImportJobResponse])
 -> ImportJobsResponse -> f ImportJobsResponse)
-> (([ImportJobResponse] -> f [ImportJobResponse])
    -> [ImportJobResponse] -> f [ImportJobResponse])
-> ([ImportJobResponse] -> f [ImportJobResponse])
-> ImportJobsResponse
-> f ImportJobsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ImportJobResponse] -> f [ImportJobResponse])
-> [ImportJobResponse] -> f [ImportJobResponse]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON ImportJobsResponse where
  parseJSON :: Value -> Parser ImportJobsResponse
parseJSON =
    String
-> (Object -> Parser ImportJobsResponse)
-> Value
-> Parser ImportJobsResponse
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ImportJobsResponse"
      ( \Object
x ->
          Maybe Text -> [ImportJobResponse] -> ImportJobsResponse
ImportJobsResponse'
            (Maybe Text -> [ImportJobResponse] -> ImportJobsResponse)
-> Parser (Maybe Text)
-> Parser ([ImportJobResponse] -> ImportJobsResponse)
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
"NextToken")
            Parser ([ImportJobResponse] -> ImportJobsResponse)
-> Parser [ImportJobResponse] -> Parser ImportJobsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe [ImportJobResponse])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Item" Parser (Maybe [ImportJobResponse])
-> [ImportJobResponse] -> Parser [ImportJobResponse]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [ImportJobResponse]
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable ImportJobsResponse

instance Prelude.NFData ImportJobsResponse