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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | An object representing the array properties of a job.
--
-- /See:/ 'newArrayPropertiesDetail' smart constructor.
data ArrayPropertiesDetail = ArrayPropertiesDetail'
  { -- | 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),
    -- | 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
  }
  deriving (ArrayPropertiesDetail -> ArrayPropertiesDetail -> Bool
(ArrayPropertiesDetail -> ArrayPropertiesDetail -> Bool)
-> (ArrayPropertiesDetail -> ArrayPropertiesDetail -> Bool)
-> Eq ArrayPropertiesDetail
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]
(Int -> ReadS ArrayPropertiesDetail)
-> ReadS [ArrayPropertiesDetail]
-> ReadPrec ArrayPropertiesDetail
-> ReadPrec [ArrayPropertiesDetail]
-> Read 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
(Int -> ArrayPropertiesDetail -> ShowS)
-> (ArrayPropertiesDetail -> String)
-> ([ArrayPropertiesDetail] -> ShowS)
-> Show ArrayPropertiesDetail
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. ArrayPropertiesDetail -> Rep ArrayPropertiesDetail x)
-> (forall x. Rep ArrayPropertiesDetail x -> ArrayPropertiesDetail)
-> Generic ArrayPropertiesDetail
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:
--
-- '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.
--
-- 'index', 'arrayPropertiesDetail_index' - The job index within the array that\'s associated with this job. This
-- parameter is returned for array job children.
newArrayPropertiesDetail ::
  ArrayPropertiesDetail
newArrayPropertiesDetail :: ArrayPropertiesDetail
newArrayPropertiesDetail =
  ArrayPropertiesDetail' :: Maybe Int
-> Maybe (HashMap Text Int) -> Maybe Int -> ArrayPropertiesDetail
ArrayPropertiesDetail'
    { $sel:size:ArrayPropertiesDetail' :: Maybe Int
size = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:statusSummary:ArrayPropertiesDetail' :: Maybe (HashMap Text Int)
statusSummary = Maybe (HashMap Text Int)
forall a. Maybe a
Prelude.Nothing,
      $sel:index:ArrayPropertiesDetail' :: Maybe Int
index = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: (Maybe Int -> f (Maybe Int))
-> ArrayPropertiesDetail -> f ArrayPropertiesDetail
arrayPropertiesDetail_size = (ArrayPropertiesDetail -> Maybe Int)
-> (ArrayPropertiesDetail -> Maybe Int -> ArrayPropertiesDetail)
-> Lens
     ArrayPropertiesDetail ArrayPropertiesDetail (Maybe Int) (Maybe Int)
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 :: (Maybe (HashMap Text Int) -> f (Maybe (HashMap Text Int)))
-> ArrayPropertiesDetail -> f ArrayPropertiesDetail
arrayPropertiesDetail_statusSummary = (ArrayPropertiesDetail -> Maybe (HashMap Text Int))
-> (ArrayPropertiesDetail
    -> Maybe (HashMap Text Int) -> ArrayPropertiesDetail)
-> Lens
     ArrayPropertiesDetail
     ArrayPropertiesDetail
     (Maybe (HashMap Text Int))
     (Maybe (HashMap Text Int))
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) ((Maybe (HashMap Text Int) -> f (Maybe (HashMap Text Int)))
 -> ArrayPropertiesDetail -> f ArrayPropertiesDetail)
-> ((Maybe (HashMap Text Int) -> f (Maybe (HashMap Text Int)))
    -> Maybe (HashMap Text Int) -> f (Maybe (HashMap Text Int)))
-> (Maybe (HashMap Text Int) -> f (Maybe (HashMap Text Int)))
-> ArrayPropertiesDetail
-> f ArrayPropertiesDetail
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Int)
  (HashMap Text Int)
  (HashMap Text Int)
  (HashMap Text Int)
-> Iso
     (Maybe (HashMap Text Int))
     (Maybe (HashMap Text Int))
     (Maybe (HashMap Text Int))
     (Maybe (HashMap Text Int))
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 AnIso
  (HashMap Text Int)
  (HashMap Text Int)
  (HashMap Text Int)
  (HashMap Text Int)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | 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 :: (Maybe Int -> f (Maybe Int))
-> ArrayPropertiesDetail -> f ArrayPropertiesDetail
arrayPropertiesDetail_index = (ArrayPropertiesDetail -> Maybe Int)
-> (ArrayPropertiesDetail -> Maybe Int -> ArrayPropertiesDetail)
-> Lens
     ArrayPropertiesDetail ArrayPropertiesDetail (Maybe Int) (Maybe Int)
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)

instance Core.FromJSON ArrayPropertiesDetail where
  parseJSON :: Value -> Parser ArrayPropertiesDetail
parseJSON =
    String
-> (Object -> Parser ArrayPropertiesDetail)
-> Value
-> Parser ArrayPropertiesDetail
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ArrayPropertiesDetail"
      ( \Object
x ->
          Maybe Int
-> Maybe (HashMap Text Int) -> Maybe Int -> ArrayPropertiesDetail
ArrayPropertiesDetail'
            (Maybe Int
 -> Maybe (HashMap Text Int) -> Maybe Int -> ArrayPropertiesDetail)
-> Parser (Maybe Int)
-> Parser
     (Maybe (HashMap Text Int) -> Maybe Int -> ArrayPropertiesDetail)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"size")
            Parser
  (Maybe (HashMap Text Int) -> Maybe Int -> ArrayPropertiesDetail)
-> Parser (Maybe (HashMap Text Int))
-> Parser (Maybe Int -> ArrayPropertiesDetail)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Int)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"statusSummary" Parser (Maybe (Maybe (HashMap Text Int)))
-> Maybe (HashMap Text Int) -> Parser (Maybe (HashMap Text Int))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Int)
forall a. Monoid a => a
Prelude.mempty)
            Parser (Maybe Int -> ArrayPropertiesDetail)
-> Parser (Maybe Int) -> Parser ArrayPropertiesDetail
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"index")
      )

instance Prelude.Hashable ArrayPropertiesDetail

instance Prelude.NFData ArrayPropertiesDetail