{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.IoTDeviceAdvisor.Types.TestResult where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoTDeviceAdvisor.Types.GroupResult
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
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]
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
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. 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' {$sel:groups:TestResult' :: Maybe [GroupResult]
groups = forall a. Maybe a
Prelude.Nothing}

-- | Show each group of test results.
testResult_groups :: Lens.Lens' TestResult (Prelude.Maybe [GroupResult])
testResult_groups :: Lens' TestResult (Maybe [GroupResult])
testResult_groups = 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) 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 TestResult where
  parseJSON :: Value -> Parser TestResult
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"TestResult"
      ( \Object
x ->
          Maybe [GroupResult] -> TestResult
TestResult'
            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
"groups" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable TestResult where
  hashWithSalt :: Int -> TestResult -> Int
hashWithSalt Int
_salt TestResult' {Maybe [GroupResult]
groups :: Maybe [GroupResult]
$sel:groups:TestResult' :: TestResult -> Maybe [GroupResult]
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [GroupResult]
groups

instance Prelude.NFData TestResult where
  rnf :: TestResult -> ()
rnf TestResult' {Maybe [GroupResult]
groups :: Maybe [GroupResult]
$sel:groups:TestResult' :: TestResult -> Maybe [GroupResult]
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe [GroupResult]
groups