{-# 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.ArrayPropertiesDetail
-- 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.ArrayPropertiesDetail 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:/ 'newArrayPropertiesDetail' smart constructor.
data ArrayPropertiesDetail = ArrayPropertiesDetail'
  { -- | The job index within the array that\'s associated with this job. This
    -- parameter is returned for array job children.
    ArrayPropertiesDetail -> Maybe Int
index :: Prelude.Maybe Prelude.Int,
    -- | The size of the array job. This parameter is returned for parent array
    -- jobs.
    ArrayPropertiesDetail -> Maybe Int
size :: Prelude.Maybe Prelude.Int,
    -- | A summary of the number of array job children in each available job
    -- status. This parameter is returned for parent array jobs.
    ArrayPropertiesDetail -> Maybe (HashMap Text Int)
statusSummary :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Int)
  }
  deriving (ArrayPropertiesDetail -> ArrayPropertiesDetail -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ArrayPropertiesDetail -> ArrayPropertiesDetail -> Bool
$c/= :: ArrayPropertiesDetail -> ArrayPropertiesDetail -> Bool
== :: ArrayPropertiesDetail -> ArrayPropertiesDetail -> Bool
$c== :: ArrayPropertiesDetail -> ArrayPropertiesDetail -> Bool
Prelude.Eq, ReadPrec [ArrayPropertiesDetail]
ReadPrec ArrayPropertiesDetail
Int -> ReadS ArrayPropertiesDetail
ReadS [ArrayPropertiesDetail]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ArrayPropertiesDetail]
$creadListPrec :: ReadPrec [ArrayPropertiesDetail]
readPrec :: ReadPrec ArrayPropertiesDetail
$creadPrec :: ReadPrec ArrayPropertiesDetail
readList :: ReadS [ArrayPropertiesDetail]
$creadList :: ReadS [ArrayPropertiesDetail]
readsPrec :: Int -> ReadS ArrayPropertiesDetail
$creadsPrec :: Int -> ReadS ArrayPropertiesDetail
Prelude.Read, Int -> ArrayPropertiesDetail -> ShowS
[ArrayPropertiesDetail] -> ShowS
ArrayPropertiesDetail -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ArrayPropertiesDetail] -> ShowS
$cshowList :: [ArrayPropertiesDetail] -> ShowS
show :: ArrayPropertiesDetail -> String
$cshow :: ArrayPropertiesDetail -> String
showsPrec :: Int -> ArrayPropertiesDetail -> ShowS
$cshowsPrec :: Int -> ArrayPropertiesDetail -> ShowS
Prelude.Show, forall x. Rep ArrayPropertiesDetail x -> ArrayPropertiesDetail
forall x. ArrayPropertiesDetail -> Rep ArrayPropertiesDetail x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ArrayPropertiesDetail x -> ArrayPropertiesDetail
$cfrom :: forall x. ArrayPropertiesDetail -> Rep ArrayPropertiesDetail x
Prelude.Generic)

-- |
-- Create a value of 'ArrayPropertiesDetail' 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', 'arrayPropertiesDetail_index' - The job index within the array that\'s associated with this job. This
-- parameter is returned for array job children.
--
-- 'size', 'arrayPropertiesDetail_size' - The size of the array job. This parameter is returned for parent array
-- jobs.
--
-- 'statusSummary', 'arrayPropertiesDetail_statusSummary' - A summary of the number of array job children in each available job
-- status. This parameter is returned for parent array jobs.
newArrayPropertiesDetail ::
  ArrayPropertiesDetail
newArrayPropertiesDetail :: ArrayPropertiesDetail
newArrayPropertiesDetail =
  ArrayPropertiesDetail'
    { $sel:index:ArrayPropertiesDetail' :: Maybe Int
index = forall a. Maybe a
Prelude.Nothing,
      $sel:size:ArrayPropertiesDetail' :: Maybe Int
size = forall a. Maybe a
Prelude.Nothing,
      $sel:statusSummary:ArrayPropertiesDetail' :: Maybe (HashMap Text Int)
statusSummary = forall a. Maybe a
Prelude.Nothing
    }

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

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

-- | A summary of the number of array job children in each available job
-- status. This parameter is returned for parent array jobs.
arrayPropertiesDetail_statusSummary :: Lens.Lens' ArrayPropertiesDetail (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Int))
arrayPropertiesDetail_statusSummary :: Lens' ArrayPropertiesDetail (Maybe (HashMap Text Int))
arrayPropertiesDetail_statusSummary = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ArrayPropertiesDetail' {Maybe (HashMap Text Int)
statusSummary :: Maybe (HashMap Text Int)
$sel:statusSummary:ArrayPropertiesDetail' :: ArrayPropertiesDetail -> Maybe (HashMap Text Int)
statusSummary} -> Maybe (HashMap Text Int)
statusSummary) (\s :: ArrayPropertiesDetail
s@ArrayPropertiesDetail' {} Maybe (HashMap Text Int)
a -> ArrayPropertiesDetail
s {$sel:statusSummary:ArrayPropertiesDetail' :: Maybe (HashMap Text Int)
statusSummary = Maybe (HashMap Text Int)
a} :: ArrayPropertiesDetail) 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

instance Data.FromJSON ArrayPropertiesDetail where
  parseJSON :: Value -> Parser ArrayPropertiesDetail
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ArrayPropertiesDetail"
      ( \Object
x ->
          Maybe Int
-> Maybe Int -> Maybe (HashMap Text Int) -> ArrayPropertiesDetail
ArrayPropertiesDetail'
            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")
            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
"statusSummary" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable ArrayPropertiesDetail where
  hashWithSalt :: Int -> ArrayPropertiesDetail -> Int
hashWithSalt Int
_salt ArrayPropertiesDetail' {Maybe Int
Maybe (HashMap Text Int)
statusSummary :: Maybe (HashMap Text Int)
size :: Maybe Int
index :: Maybe Int
$sel:statusSummary:ArrayPropertiesDetail' :: ArrayPropertiesDetail -> Maybe (HashMap Text Int)
$sel:size:ArrayPropertiesDetail' :: ArrayPropertiesDetail -> Maybe Int
$sel:index:ArrayPropertiesDetail' :: ArrayPropertiesDetail -> 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
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Int)
statusSummary

instance Prelude.NFData ArrayPropertiesDetail where
  rnf :: ArrayPropertiesDetail -> ()
rnf ArrayPropertiesDetail' {Maybe Int
Maybe (HashMap Text Int)
statusSummary :: Maybe (HashMap Text Int)
size :: Maybe Int
index :: Maybe Int
$sel:statusSummary:ArrayPropertiesDetail' :: ArrayPropertiesDetail -> Maybe (HashMap Text Int)
$sel:size:ArrayPropertiesDetail' :: ArrayPropertiesDetail -> Maybe Int
$sel:index:ArrayPropertiesDetail' :: ArrayPropertiesDetail -> 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
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Int)
statusSummary