{-# 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.IoTDeviceAdvisor.Types.TestResult
-- 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.IoTDeviceAdvisor.Types.TestResult where

import qualified Amazonka.Core as Core
import Amazonka.IoTDeviceAdvisor.Types.GroupResult
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Show each group result.
--
-- /See:/ 'newTestResult' smart constructor.
data TestResult = TestResult'
  { -- | Show each group of test results.
    TestResult -> Maybe [GroupResult]
groups :: Prelude.Maybe [GroupResult]
  }
  deriving (TestResult -> TestResult -> Bool
(TestResult -> TestResult -> Bool)
-> (TestResult -> TestResult -> Bool) -> Eq TestResult
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TestResult -> TestResult -> Bool
$c/= :: TestResult -> TestResult -> Bool
== :: TestResult -> TestResult -> Bool
$c== :: TestResult -> TestResult -> Bool
Prelude.Eq, ReadPrec [TestResult]
ReadPrec TestResult
Int -> ReadS TestResult
ReadS [TestResult]
(Int -> ReadS TestResult)
-> ReadS [TestResult]
-> ReadPrec TestResult
-> ReadPrec [TestResult]
-> Read TestResult
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TestResult]
$creadListPrec :: ReadPrec [TestResult]
readPrec :: ReadPrec TestResult
$creadPrec :: ReadPrec TestResult
readList :: ReadS [TestResult]
$creadList :: ReadS [TestResult]
readsPrec :: Int -> ReadS TestResult
$creadsPrec :: Int -> ReadS TestResult
Prelude.Read, Int -> TestResult -> ShowS
[TestResult] -> ShowS
TestResult -> String
(Int -> TestResult -> ShowS)
-> (TestResult -> String)
-> ([TestResult] -> ShowS)
-> Show TestResult
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TestResult] -> ShowS
$cshowList :: [TestResult] -> ShowS
show :: TestResult -> String
$cshow :: TestResult -> String
showsPrec :: Int -> TestResult -> ShowS
$cshowsPrec :: Int -> TestResult -> ShowS
Prelude.Show, (forall x. TestResult -> Rep TestResult x)
-> (forall x. Rep TestResult x -> TestResult) -> Generic TestResult
forall x. Rep TestResult x -> TestResult
forall x. TestResult -> Rep TestResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TestResult x -> TestResult
$cfrom :: forall x. TestResult -> Rep TestResult x
Prelude.Generic)

-- |
-- Create a value of 'TestResult' 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:
--
-- 'groups', 'testResult_groups' - Show each group of test results.
newTestResult ::
  TestResult
newTestResult :: TestResult
newTestResult = TestResult' :: Maybe [GroupResult] -> TestResult
TestResult' {$sel:groups:TestResult' :: Maybe [GroupResult]
groups = Maybe [GroupResult]
forall a. Maybe a
Prelude.Nothing}

-- | Show each group of test results.
testResult_groups :: Lens.Lens' TestResult (Prelude.Maybe [GroupResult])
testResult_groups :: (Maybe [GroupResult] -> f (Maybe [GroupResult]))
-> TestResult -> f TestResult
testResult_groups = (TestResult -> Maybe [GroupResult])
-> (TestResult -> Maybe [GroupResult] -> TestResult)
-> Lens
     TestResult TestResult (Maybe [GroupResult]) (Maybe [GroupResult])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TestResult' {Maybe [GroupResult]
groups :: Maybe [GroupResult]
$sel:groups:TestResult' :: TestResult -> Maybe [GroupResult]
groups} -> Maybe [GroupResult]
groups) (\s :: TestResult
s@TestResult' {} Maybe [GroupResult]
a -> TestResult
s {$sel:groups:TestResult' :: Maybe [GroupResult]
groups = Maybe [GroupResult]
a} :: TestResult) ((Maybe [GroupResult] -> f (Maybe [GroupResult]))
 -> TestResult -> f TestResult)
-> ((Maybe [GroupResult] -> f (Maybe [GroupResult]))
    -> Maybe [GroupResult] -> f (Maybe [GroupResult]))
-> (Maybe [GroupResult] -> f (Maybe [GroupResult]))
-> TestResult
-> f TestResult
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [GroupResult] [GroupResult] [GroupResult] [GroupResult]
-> Iso
     (Maybe [GroupResult])
     (Maybe [GroupResult])
     (Maybe [GroupResult])
     (Maybe [GroupResult])
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 [GroupResult] [GroupResult] [GroupResult] [GroupResult]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON TestResult where
  parseJSON :: Value -> Parser TestResult
parseJSON =
    String
-> (Object -> Parser TestResult) -> Value -> Parser TestResult
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"TestResult"
      ( \Object
x ->
          Maybe [GroupResult] -> TestResult
TestResult'
            (Maybe [GroupResult] -> TestResult)
-> Parser (Maybe [GroupResult]) -> Parser TestResult
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [GroupResult]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"groups" Parser (Maybe (Maybe [GroupResult]))
-> Maybe [GroupResult] -> Parser (Maybe [GroupResult])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [GroupResult]
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable TestResult

instance Prelude.NFData TestResult