{-# 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.DeviceFarm.Types.Counters
-- 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.DeviceFarm.Types.Counters 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

-- | Represents entity counters.
--
-- /See:/ 'newCounters' smart constructor.
data Counters = Counters'
  { -- | The number of errored entities.
    Counters -> Maybe Int
errored :: Prelude.Maybe Prelude.Int,
    -- | The number of failed entities.
    Counters -> Maybe Int
failed :: Prelude.Maybe Prelude.Int,
    -- | The number of passed entities.
    Counters -> Maybe Int
passed :: Prelude.Maybe Prelude.Int,
    -- | The number of skipped entities.
    Counters -> Maybe Int
skipped :: Prelude.Maybe Prelude.Int,
    -- | The number of stopped entities.
    Counters -> Maybe Int
stopped :: Prelude.Maybe Prelude.Int,
    -- | The total number of entities.
    Counters -> Maybe Int
total :: Prelude.Maybe Prelude.Int,
    -- | The number of warned entities.
    Counters -> Maybe Int
warned :: Prelude.Maybe Prelude.Int
  }
  deriving (Counters -> Counters -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Counters -> Counters -> Bool
$c/= :: Counters -> Counters -> Bool
== :: Counters -> Counters -> Bool
$c== :: Counters -> Counters -> Bool
Prelude.Eq, ReadPrec [Counters]
ReadPrec Counters
Int -> ReadS Counters
ReadS [Counters]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Counters]
$creadListPrec :: ReadPrec [Counters]
readPrec :: ReadPrec Counters
$creadPrec :: ReadPrec Counters
readList :: ReadS [Counters]
$creadList :: ReadS [Counters]
readsPrec :: Int -> ReadS Counters
$creadsPrec :: Int -> ReadS Counters
Prelude.Read, Int -> Counters -> ShowS
[Counters] -> ShowS
Counters -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Counters] -> ShowS
$cshowList :: [Counters] -> ShowS
show :: Counters -> String
$cshow :: Counters -> String
showsPrec :: Int -> Counters -> ShowS
$cshowsPrec :: Int -> Counters -> ShowS
Prelude.Show, forall x. Rep Counters x -> Counters
forall x. Counters -> Rep Counters x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Counters x -> Counters
$cfrom :: forall x. Counters -> Rep Counters x
Prelude.Generic)

-- |
-- Create a value of 'Counters' 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:
--
-- 'errored', 'counters_errored' - The number of errored entities.
--
-- 'failed', 'counters_failed' - The number of failed entities.
--
-- 'passed', 'counters_passed' - The number of passed entities.
--
-- 'skipped', 'counters_skipped' - The number of skipped entities.
--
-- 'stopped', 'counters_stopped' - The number of stopped entities.
--
-- 'total', 'counters_total' - The total number of entities.
--
-- 'warned', 'counters_warned' - The number of warned entities.
newCounters ::
  Counters
newCounters :: Counters
newCounters =
  Counters'
    { $sel:errored:Counters' :: Maybe Int
errored = forall a. Maybe a
Prelude.Nothing,
      $sel:failed:Counters' :: Maybe Int
failed = forall a. Maybe a
Prelude.Nothing,
      $sel:passed:Counters' :: Maybe Int
passed = forall a. Maybe a
Prelude.Nothing,
      $sel:skipped:Counters' :: Maybe Int
skipped = forall a. Maybe a
Prelude.Nothing,
      $sel:stopped:Counters' :: Maybe Int
stopped = forall a. Maybe a
Prelude.Nothing,
      $sel:total:Counters' :: Maybe Int
total = forall a. Maybe a
Prelude.Nothing,
      $sel:warned:Counters' :: Maybe Int
warned = forall a. Maybe a
Prelude.Nothing
    }

-- | The number of errored entities.
counters_errored :: Lens.Lens' Counters (Prelude.Maybe Prelude.Int)
counters_errored :: Lens' Counters (Maybe Int)
counters_errored = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Counters' {Maybe Int
errored :: Maybe Int
$sel:errored:Counters' :: Counters -> Maybe Int
errored} -> Maybe Int
errored) (\s :: Counters
s@Counters' {} Maybe Int
a -> Counters
s {$sel:errored:Counters' :: Maybe Int
errored = Maybe Int
a} :: Counters)

-- | The number of failed entities.
counters_failed :: Lens.Lens' Counters (Prelude.Maybe Prelude.Int)
counters_failed :: Lens' Counters (Maybe Int)
counters_failed = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Counters' {Maybe Int
failed :: Maybe Int
$sel:failed:Counters' :: Counters -> Maybe Int
failed} -> Maybe Int
failed) (\s :: Counters
s@Counters' {} Maybe Int
a -> Counters
s {$sel:failed:Counters' :: Maybe Int
failed = Maybe Int
a} :: Counters)

-- | The number of passed entities.
counters_passed :: Lens.Lens' Counters (Prelude.Maybe Prelude.Int)
counters_passed :: Lens' Counters (Maybe Int)
counters_passed = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Counters' {Maybe Int
passed :: Maybe Int
$sel:passed:Counters' :: Counters -> Maybe Int
passed} -> Maybe Int
passed) (\s :: Counters
s@Counters' {} Maybe Int
a -> Counters
s {$sel:passed:Counters' :: Maybe Int
passed = Maybe Int
a} :: Counters)

-- | The number of skipped entities.
counters_skipped :: Lens.Lens' Counters (Prelude.Maybe Prelude.Int)
counters_skipped :: Lens' Counters (Maybe Int)
counters_skipped = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Counters' {Maybe Int
skipped :: Maybe Int
$sel:skipped:Counters' :: Counters -> Maybe Int
skipped} -> Maybe Int
skipped) (\s :: Counters
s@Counters' {} Maybe Int
a -> Counters
s {$sel:skipped:Counters' :: Maybe Int
skipped = Maybe Int
a} :: Counters)

-- | The number of stopped entities.
counters_stopped :: Lens.Lens' Counters (Prelude.Maybe Prelude.Int)
counters_stopped :: Lens' Counters (Maybe Int)
counters_stopped = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Counters' {Maybe Int
stopped :: Maybe Int
$sel:stopped:Counters' :: Counters -> Maybe Int
stopped} -> Maybe Int
stopped) (\s :: Counters
s@Counters' {} Maybe Int
a -> Counters
s {$sel:stopped:Counters' :: Maybe Int
stopped = Maybe Int
a} :: Counters)

-- | The total number of entities.
counters_total :: Lens.Lens' Counters (Prelude.Maybe Prelude.Int)
counters_total :: Lens' Counters (Maybe Int)
counters_total = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Counters' {Maybe Int
total :: Maybe Int
$sel:total:Counters' :: Counters -> Maybe Int
total} -> Maybe Int
total) (\s :: Counters
s@Counters' {} Maybe Int
a -> Counters
s {$sel:total:Counters' :: Maybe Int
total = Maybe Int
a} :: Counters)

-- | The number of warned entities.
counters_warned :: Lens.Lens' Counters (Prelude.Maybe Prelude.Int)
counters_warned :: Lens' Counters (Maybe Int)
counters_warned = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Counters' {Maybe Int
warned :: Maybe Int
$sel:warned:Counters' :: Counters -> Maybe Int
warned} -> Maybe Int
warned) (\s :: Counters
s@Counters' {} Maybe Int
a -> Counters
s {$sel:warned:Counters' :: Maybe Int
warned = Maybe Int
a} :: Counters)

instance Data.FromJSON Counters where
  parseJSON :: Value -> Parser Counters
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Counters"
      ( \Object
x ->
          Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> Counters
Counters'
            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
"errored")
            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
"failed")
            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
"passed")
            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
"skipped")
            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
"stopped")
            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
"total")
            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
"warned")
      )

instance Prelude.Hashable Counters where
  hashWithSalt :: Int -> Counters -> Int
hashWithSalt Int
_salt Counters' {Maybe Int
warned :: Maybe Int
total :: Maybe Int
stopped :: Maybe Int
skipped :: Maybe Int
passed :: Maybe Int
failed :: Maybe Int
errored :: Maybe Int
$sel:warned:Counters' :: Counters -> Maybe Int
$sel:total:Counters' :: Counters -> Maybe Int
$sel:stopped:Counters' :: Counters -> Maybe Int
$sel:skipped:Counters' :: Counters -> Maybe Int
$sel:passed:Counters' :: Counters -> Maybe Int
$sel:failed:Counters' :: Counters -> Maybe Int
$sel:errored:Counters' :: Counters -> Maybe Int
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
errored
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
failed
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
passed
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
skipped
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
stopped
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
total
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
warned

instance Prelude.NFData Counters where
  rnf :: Counters -> ()
rnf Counters' {Maybe Int
warned :: Maybe Int
total :: Maybe Int
stopped :: Maybe Int
skipped :: Maybe Int
passed :: Maybe Int
failed :: Maybe Int
errored :: Maybe Int
$sel:warned:Counters' :: Counters -> Maybe Int
$sel:total:Counters' :: Counters -> Maybe Int
$sel:stopped:Counters' :: Counters -> Maybe Int
$sel:skipped:Counters' :: Counters -> Maybe Int
$sel:passed:Counters' :: Counters -> Maybe Int
$sel:failed:Counters' :: Counters -> Maybe Int
$sel:errored:Counters' :: Counters -> Maybe Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
errored
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
failed
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
passed
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
skipped
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
stopped
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
total
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
warned