{-# 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.RobOMaker.Types.FinishedWorldsSummary
-- 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.RobOMaker.Types.FinishedWorldsSummary where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.RobOMaker.Types.FailureSummary

-- | Information about worlds that finished.
--
-- /See:/ 'newFinishedWorldsSummary' smart constructor.
data FinishedWorldsSummary = FinishedWorldsSummary'
  { -- | A list of worlds that succeeded.
    FinishedWorldsSummary -> Maybe (NonEmpty Text)
succeededWorlds :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    -- | Information about worlds that failed.
    FinishedWorldsSummary -> Maybe FailureSummary
failureSummary :: Prelude.Maybe FailureSummary,
    -- | The total number of finished worlds.
    FinishedWorldsSummary -> Maybe Int
finishedCount :: Prelude.Maybe Prelude.Int
  }
  deriving (FinishedWorldsSummary -> FinishedWorldsSummary -> Bool
(FinishedWorldsSummary -> FinishedWorldsSummary -> Bool)
-> (FinishedWorldsSummary -> FinishedWorldsSummary -> Bool)
-> Eq FinishedWorldsSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FinishedWorldsSummary -> FinishedWorldsSummary -> Bool
$c/= :: FinishedWorldsSummary -> FinishedWorldsSummary -> Bool
== :: FinishedWorldsSummary -> FinishedWorldsSummary -> Bool
$c== :: FinishedWorldsSummary -> FinishedWorldsSummary -> Bool
Prelude.Eq, ReadPrec [FinishedWorldsSummary]
ReadPrec FinishedWorldsSummary
Int -> ReadS FinishedWorldsSummary
ReadS [FinishedWorldsSummary]
(Int -> ReadS FinishedWorldsSummary)
-> ReadS [FinishedWorldsSummary]
-> ReadPrec FinishedWorldsSummary
-> ReadPrec [FinishedWorldsSummary]
-> Read FinishedWorldsSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FinishedWorldsSummary]
$creadListPrec :: ReadPrec [FinishedWorldsSummary]
readPrec :: ReadPrec FinishedWorldsSummary
$creadPrec :: ReadPrec FinishedWorldsSummary
readList :: ReadS [FinishedWorldsSummary]
$creadList :: ReadS [FinishedWorldsSummary]
readsPrec :: Int -> ReadS FinishedWorldsSummary
$creadsPrec :: Int -> ReadS FinishedWorldsSummary
Prelude.Read, Int -> FinishedWorldsSummary -> ShowS
[FinishedWorldsSummary] -> ShowS
FinishedWorldsSummary -> String
(Int -> FinishedWorldsSummary -> ShowS)
-> (FinishedWorldsSummary -> String)
-> ([FinishedWorldsSummary] -> ShowS)
-> Show FinishedWorldsSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FinishedWorldsSummary] -> ShowS
$cshowList :: [FinishedWorldsSummary] -> ShowS
show :: FinishedWorldsSummary -> String
$cshow :: FinishedWorldsSummary -> String
showsPrec :: Int -> FinishedWorldsSummary -> ShowS
$cshowsPrec :: Int -> FinishedWorldsSummary -> ShowS
Prelude.Show, (forall x. FinishedWorldsSummary -> Rep FinishedWorldsSummary x)
-> (forall x. Rep FinishedWorldsSummary x -> FinishedWorldsSummary)
-> Generic FinishedWorldsSummary
forall x. Rep FinishedWorldsSummary x -> FinishedWorldsSummary
forall x. FinishedWorldsSummary -> Rep FinishedWorldsSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FinishedWorldsSummary x -> FinishedWorldsSummary
$cfrom :: forall x. FinishedWorldsSummary -> Rep FinishedWorldsSummary x
Prelude.Generic)

-- |
-- Create a value of 'FinishedWorldsSummary' 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:
--
-- 'succeededWorlds', 'finishedWorldsSummary_succeededWorlds' - A list of worlds that succeeded.
--
-- 'failureSummary', 'finishedWorldsSummary_failureSummary' - Information about worlds that failed.
--
-- 'finishedCount', 'finishedWorldsSummary_finishedCount' - The total number of finished worlds.
newFinishedWorldsSummary ::
  FinishedWorldsSummary
newFinishedWorldsSummary :: FinishedWorldsSummary
newFinishedWorldsSummary =
  FinishedWorldsSummary' :: Maybe (NonEmpty Text)
-> Maybe FailureSummary -> Maybe Int -> FinishedWorldsSummary
FinishedWorldsSummary'
    { $sel:succeededWorlds:FinishedWorldsSummary' :: Maybe (NonEmpty Text)
succeededWorlds =
        Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:failureSummary:FinishedWorldsSummary' :: Maybe FailureSummary
failureSummary = Maybe FailureSummary
forall a. Maybe a
Prelude.Nothing,
      $sel:finishedCount:FinishedWorldsSummary' :: Maybe Int
finishedCount = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | A list of worlds that succeeded.
finishedWorldsSummary_succeededWorlds :: Lens.Lens' FinishedWorldsSummary (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
finishedWorldsSummary_succeededWorlds :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> FinishedWorldsSummary -> f FinishedWorldsSummary
finishedWorldsSummary_succeededWorlds = (FinishedWorldsSummary -> Maybe (NonEmpty Text))
-> (FinishedWorldsSummary
    -> Maybe (NonEmpty Text) -> FinishedWorldsSummary)
-> Lens
     FinishedWorldsSummary
     FinishedWorldsSummary
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FinishedWorldsSummary' {Maybe (NonEmpty Text)
succeededWorlds :: Maybe (NonEmpty Text)
$sel:succeededWorlds:FinishedWorldsSummary' :: FinishedWorldsSummary -> Maybe (NonEmpty Text)
succeededWorlds} -> Maybe (NonEmpty Text)
succeededWorlds) (\s :: FinishedWorldsSummary
s@FinishedWorldsSummary' {} Maybe (NonEmpty Text)
a -> FinishedWorldsSummary
s {$sel:succeededWorlds:FinishedWorldsSummary' :: Maybe (NonEmpty Text)
succeededWorlds = Maybe (NonEmpty Text)
a} :: FinishedWorldsSummary) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
 -> FinishedWorldsSummary -> f FinishedWorldsSummary)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
    -> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> FinishedWorldsSummary
-> f FinishedWorldsSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
-> Iso
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
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
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Information about worlds that failed.
finishedWorldsSummary_failureSummary :: Lens.Lens' FinishedWorldsSummary (Prelude.Maybe FailureSummary)
finishedWorldsSummary_failureSummary :: (Maybe FailureSummary -> f (Maybe FailureSummary))
-> FinishedWorldsSummary -> f FinishedWorldsSummary
finishedWorldsSummary_failureSummary = (FinishedWorldsSummary -> Maybe FailureSummary)
-> (FinishedWorldsSummary
    -> Maybe FailureSummary -> FinishedWorldsSummary)
-> Lens
     FinishedWorldsSummary
     FinishedWorldsSummary
     (Maybe FailureSummary)
     (Maybe FailureSummary)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FinishedWorldsSummary' {Maybe FailureSummary
failureSummary :: Maybe FailureSummary
$sel:failureSummary:FinishedWorldsSummary' :: FinishedWorldsSummary -> Maybe FailureSummary
failureSummary} -> Maybe FailureSummary
failureSummary) (\s :: FinishedWorldsSummary
s@FinishedWorldsSummary' {} Maybe FailureSummary
a -> FinishedWorldsSummary
s {$sel:failureSummary:FinishedWorldsSummary' :: Maybe FailureSummary
failureSummary = Maybe FailureSummary
a} :: FinishedWorldsSummary)

-- | The total number of finished worlds.
finishedWorldsSummary_finishedCount :: Lens.Lens' FinishedWorldsSummary (Prelude.Maybe Prelude.Int)
finishedWorldsSummary_finishedCount :: (Maybe Int -> f (Maybe Int))
-> FinishedWorldsSummary -> f FinishedWorldsSummary
finishedWorldsSummary_finishedCount = (FinishedWorldsSummary -> Maybe Int)
-> (FinishedWorldsSummary -> Maybe Int -> FinishedWorldsSummary)
-> Lens
     FinishedWorldsSummary FinishedWorldsSummary (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FinishedWorldsSummary' {Maybe Int
finishedCount :: Maybe Int
$sel:finishedCount:FinishedWorldsSummary' :: FinishedWorldsSummary -> Maybe Int
finishedCount} -> Maybe Int
finishedCount) (\s :: FinishedWorldsSummary
s@FinishedWorldsSummary' {} Maybe Int
a -> FinishedWorldsSummary
s {$sel:finishedCount:FinishedWorldsSummary' :: Maybe Int
finishedCount = Maybe Int
a} :: FinishedWorldsSummary)

instance Core.FromJSON FinishedWorldsSummary where
  parseJSON :: Value -> Parser FinishedWorldsSummary
parseJSON =
    String
-> (Object -> Parser FinishedWorldsSummary)
-> Value
-> Parser FinishedWorldsSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"FinishedWorldsSummary"
      ( \Object
x ->
          Maybe (NonEmpty Text)
-> Maybe FailureSummary -> Maybe Int -> FinishedWorldsSummary
FinishedWorldsSummary'
            (Maybe (NonEmpty Text)
 -> Maybe FailureSummary -> Maybe Int -> FinishedWorldsSummary)
-> Parser (Maybe (NonEmpty Text))
-> Parser
     (Maybe FailureSummary -> Maybe Int -> FinishedWorldsSummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (NonEmpty Text))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"succeededWorlds")
            Parser (Maybe FailureSummary -> Maybe Int -> FinishedWorldsSummary)
-> Parser (Maybe FailureSummary)
-> Parser (Maybe Int -> FinishedWorldsSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe FailureSummary)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"failureSummary")
            Parser (Maybe Int -> FinishedWorldsSummary)
-> Parser (Maybe Int) -> Parser FinishedWorldsSummary
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
"finishedCount")
      )

instance Prelude.Hashable FinishedWorldsSummary

instance Prelude.NFData FinishedWorldsSummary