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

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

-- | Represents entity counters.
--
-- /See:/ 'newCounters' smart constructor.
data Counters = Counters'
  { -- | 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 warned entities.
    Counters -> Maybe Int
warned :: 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 failed entities.
    Counters -> Maybe Int
failed :: Prelude.Maybe Prelude.Int,
    -- | The number of errored entities.
    Counters -> Maybe Int
errored :: Prelude.Maybe Prelude.Int
  }
  deriving (Counters -> Counters -> Bool
(Counters -> Counters -> Bool)
-> (Counters -> Counters -> Bool) -> Eq Counters
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]
(Int -> ReadS Counters)
-> ReadS [Counters]
-> ReadPrec Counters
-> ReadPrec [Counters]
-> Read 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
(Int -> Counters -> ShowS)
-> (Counters -> String) -> ([Counters] -> ShowS) -> Show Counters
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. Counters -> Rep Counters x)
-> (forall x. Rep Counters x -> Counters) -> Generic Counters
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:
--
-- 'passed', 'counters_passed' - The number of passed entities.
--
-- 'skipped', 'counters_skipped' - The number of skipped entities.
--
-- 'warned', 'counters_warned' - The number of warned entities.
--
-- 'stopped', 'counters_stopped' - The number of stopped entities.
--
-- 'total', 'counters_total' - The total number of entities.
--
-- 'failed', 'counters_failed' - The number of failed entities.
--
-- 'errored', 'counters_errored' - The number of errored entities.
newCounters ::
  Counters
newCounters :: Counters
newCounters =
  Counters' :: Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> Counters
Counters'
    { $sel:passed:Counters' :: Maybe Int
passed = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:skipped:Counters' :: Maybe Int
skipped = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:warned:Counters' :: Maybe Int
warned = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:stopped:Counters' :: Maybe Int
stopped = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:total:Counters' :: Maybe Int
total = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:failed:Counters' :: Maybe Int
failed = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:errored:Counters' :: Maybe Int
errored = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | The number of passed entities.
counters_passed :: Lens.Lens' Counters (Prelude.Maybe Prelude.Int)
counters_passed :: (Maybe Int -> f (Maybe Int)) -> Counters -> f Counters
counters_passed = (Counters -> Maybe Int)
-> (Counters -> Maybe Int -> Counters)
-> Lens Counters Counters (Maybe Int) (Maybe Int)
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 :: (Maybe Int -> f (Maybe Int)) -> Counters -> f Counters
counters_skipped = (Counters -> Maybe Int)
-> (Counters -> Maybe Int -> Counters)
-> Lens Counters Counters (Maybe Int) (Maybe Int)
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 warned entities.
counters_warned :: Lens.Lens' Counters (Prelude.Maybe Prelude.Int)
counters_warned :: (Maybe Int -> f (Maybe Int)) -> Counters -> f Counters
counters_warned = (Counters -> Maybe Int)
-> (Counters -> Maybe Int -> Counters)
-> Lens Counters Counters (Maybe Int) (Maybe Int)
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)

-- | The number of stopped entities.
counters_stopped :: Lens.Lens' Counters (Prelude.Maybe Prelude.Int)
counters_stopped :: (Maybe Int -> f (Maybe Int)) -> Counters -> f Counters
counters_stopped = (Counters -> Maybe Int)
-> (Counters -> Maybe Int -> Counters)
-> Lens Counters Counters (Maybe Int) (Maybe Int)
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 :: (Maybe Int -> f (Maybe Int)) -> Counters -> f Counters
counters_total = (Counters -> Maybe Int)
-> (Counters -> Maybe Int -> Counters)
-> Lens Counters Counters (Maybe Int) (Maybe Int)
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 failed entities.
counters_failed :: Lens.Lens' Counters (Prelude.Maybe Prelude.Int)
counters_failed :: (Maybe Int -> f (Maybe Int)) -> Counters -> f Counters
counters_failed = (Counters -> Maybe Int)
-> (Counters -> Maybe Int -> Counters)
-> Lens Counters Counters (Maybe Int) (Maybe Int)
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 errored entities.
counters_errored :: Lens.Lens' Counters (Prelude.Maybe Prelude.Int)
counters_errored :: (Maybe Int -> f (Maybe Int)) -> Counters -> f Counters
counters_errored = (Counters -> Maybe Int)
-> (Counters -> Maybe Int -> Counters)
-> Lens Counters Counters (Maybe Int) (Maybe Int)
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)

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

instance Prelude.Hashable Counters

instance Prelude.NFData Counters