{-# 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.Batch.Types.ArrayPropertiesSummary
-- 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.Batch.Types.ArrayPropertiesSummary 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

-- | An object that represents the array properties of a job.
--
-- /See:/ 'newArrayPropertiesSummary' smart constructor.
data ArrayPropertiesSummary = ArrayPropertiesSummary'
  { -- | The job index within the array that\'s associated with this job. This
    -- parameter is returned for children of array jobs.
    ArrayPropertiesSummary -> Maybe Int
index :: Prelude.Maybe Prelude.Int,
    -- | The size of the array job. This parameter is returned for parent array
    -- jobs.
    ArrayPropertiesSummary -> Maybe Int
size :: Prelude.Maybe Prelude.Int
  }
  deriving (ArrayPropertiesSummary -> ArrayPropertiesSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ArrayPropertiesSummary -> ArrayPropertiesSummary -> Bool
$c/= :: ArrayPropertiesSummary -> ArrayPropertiesSummary -> Bool
== :: ArrayPropertiesSummary -> ArrayPropertiesSummary -> Bool
$c== :: ArrayPropertiesSummary -> ArrayPropertiesSummary -> Bool
Prelude.Eq, ReadPrec [ArrayPropertiesSummary]
ReadPrec ArrayPropertiesSummary
Int -> ReadS ArrayPropertiesSummary
ReadS [ArrayPropertiesSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ArrayPropertiesSummary]
$creadListPrec :: ReadPrec [ArrayPropertiesSummary]
readPrec :: ReadPrec ArrayPropertiesSummary
$creadPrec :: ReadPrec ArrayPropertiesSummary
readList :: ReadS [ArrayPropertiesSummary]
$creadList :: ReadS [ArrayPropertiesSummary]
readsPrec :: Int -> ReadS ArrayPropertiesSummary
$creadsPrec :: Int -> ReadS ArrayPropertiesSummary
Prelude.Read, Int -> ArrayPropertiesSummary -> ShowS
[ArrayPropertiesSummary] -> ShowS
ArrayPropertiesSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ArrayPropertiesSummary] -> ShowS
$cshowList :: [ArrayPropertiesSummary] -> ShowS
show :: ArrayPropertiesSummary -> String
$cshow :: ArrayPropertiesSummary -> String
showsPrec :: Int -> ArrayPropertiesSummary -> ShowS
$cshowsPrec :: Int -> ArrayPropertiesSummary -> ShowS
Prelude.Show, forall x. Rep ArrayPropertiesSummary x -> ArrayPropertiesSummary
forall x. ArrayPropertiesSummary -> Rep ArrayPropertiesSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ArrayPropertiesSummary x -> ArrayPropertiesSummary
$cfrom :: forall x. ArrayPropertiesSummary -> Rep ArrayPropertiesSummary x
Prelude.Generic)

-- |
-- Create a value of 'ArrayPropertiesSummary' 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:
--
-- 'index', 'arrayPropertiesSummary_index' - The job index within the array that\'s associated with this job. This
-- parameter is returned for children of array jobs.
--
-- 'size', 'arrayPropertiesSummary_size' - The size of the array job. This parameter is returned for parent array
-- jobs.
newArrayPropertiesSummary ::
  ArrayPropertiesSummary
newArrayPropertiesSummary :: ArrayPropertiesSummary
newArrayPropertiesSummary =
  ArrayPropertiesSummary'
    { $sel:index:ArrayPropertiesSummary' :: Maybe Int
index = forall a. Maybe a
Prelude.Nothing,
      $sel:size:ArrayPropertiesSummary' :: Maybe Int
size = forall a. Maybe a
Prelude.Nothing
    }

-- | The job index within the array that\'s associated with this job. This
-- parameter is returned for children of array jobs.
arrayPropertiesSummary_index :: Lens.Lens' ArrayPropertiesSummary (Prelude.Maybe Prelude.Int)
arrayPropertiesSummary_index :: Lens' ArrayPropertiesSummary (Maybe Int)
arrayPropertiesSummary_index = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ArrayPropertiesSummary' {Maybe Int
index :: Maybe Int
$sel:index:ArrayPropertiesSummary' :: ArrayPropertiesSummary -> Maybe Int
index} -> Maybe Int
index) (\s :: ArrayPropertiesSummary
s@ArrayPropertiesSummary' {} Maybe Int
a -> ArrayPropertiesSummary
s {$sel:index:ArrayPropertiesSummary' :: Maybe Int
index = Maybe Int
a} :: ArrayPropertiesSummary)

-- | The size of the array job. This parameter is returned for parent array
-- jobs.
arrayPropertiesSummary_size :: Lens.Lens' ArrayPropertiesSummary (Prelude.Maybe Prelude.Int)
arrayPropertiesSummary_size :: Lens' ArrayPropertiesSummary (Maybe Int)
arrayPropertiesSummary_size = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ArrayPropertiesSummary' {Maybe Int
size :: Maybe Int
$sel:size:ArrayPropertiesSummary' :: ArrayPropertiesSummary -> Maybe Int
size} -> Maybe Int
size) (\s :: ArrayPropertiesSummary
s@ArrayPropertiesSummary' {} Maybe Int
a -> ArrayPropertiesSummary
s {$sel:size:ArrayPropertiesSummary' :: Maybe Int
size = Maybe Int
a} :: ArrayPropertiesSummary)

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

instance Prelude.Hashable ArrayPropertiesSummary where
  hashWithSalt :: Int -> ArrayPropertiesSummary -> Int
hashWithSalt Int
_salt ArrayPropertiesSummary' {Maybe Int
size :: Maybe Int
index :: Maybe Int
$sel:size:ArrayPropertiesSummary' :: ArrayPropertiesSummary -> Maybe Int
$sel:index:ArrayPropertiesSummary' :: ArrayPropertiesSummary -> Maybe Int
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
index
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
size

instance Prelude.NFData ArrayPropertiesSummary where
  rnf :: ArrayPropertiesSummary -> ()
rnf ArrayPropertiesSummary' {Maybe Int
size :: Maybe Int
index :: Maybe Int
$sel:size:ArrayPropertiesSummary' :: ArrayPropertiesSummary -> Maybe Int
$sel:index:ArrayPropertiesSummary' :: ArrayPropertiesSummary -> Maybe Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
index seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
size