{-# 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.CodeBuild.Types.CodeCoverageReportSummary
-- 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.CodeBuild.Types.CodeCoverageReportSummary where

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

-- | Contains a summary of a code coverage report.
--
-- Line coverage measures how many statements your tests cover. A statement
-- is a single instruction, not including comments, conditionals, etc.
--
-- Branch coverage determines if your tests cover every possible branch of
-- a control structure, such as an @if@ or @case@ statement.
--
-- /See:/ 'newCodeCoverageReportSummary' smart constructor.
data CodeCoverageReportSummary = CodeCoverageReportSummary'
  { -- | The number of conditional branches that are not covered by your tests.
    CodeCoverageReportSummary -> Maybe Natural
branchesMissed :: Prelude.Maybe Prelude.Natural,
    -- | The number of lines that are not covered by your tests.
    CodeCoverageReportSummary -> Maybe Natural
linesMissed :: Prelude.Maybe Prelude.Natural,
    -- | The number of conditional branches that are covered by your tests.
    CodeCoverageReportSummary -> Maybe Natural
branchesCovered :: Prelude.Maybe Prelude.Natural,
    -- | The number of lines that are covered by your tests.
    CodeCoverageReportSummary -> Maybe Natural
linesCovered :: Prelude.Maybe Prelude.Natural,
    -- | The percentage of branches that are covered by your tests.
    CodeCoverageReportSummary -> Maybe Double
branchCoveragePercentage :: Prelude.Maybe Prelude.Double,
    -- | The percentage of lines that are covered by your tests.
    CodeCoverageReportSummary -> Maybe Double
lineCoveragePercentage :: Prelude.Maybe Prelude.Double
  }
  deriving (CodeCoverageReportSummary -> CodeCoverageReportSummary -> Bool
(CodeCoverageReportSummary -> CodeCoverageReportSummary -> Bool)
-> (CodeCoverageReportSummary -> CodeCoverageReportSummary -> Bool)
-> Eq CodeCoverageReportSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CodeCoverageReportSummary -> CodeCoverageReportSummary -> Bool
$c/= :: CodeCoverageReportSummary -> CodeCoverageReportSummary -> Bool
== :: CodeCoverageReportSummary -> CodeCoverageReportSummary -> Bool
$c== :: CodeCoverageReportSummary -> CodeCoverageReportSummary -> Bool
Prelude.Eq, ReadPrec [CodeCoverageReportSummary]
ReadPrec CodeCoverageReportSummary
Int -> ReadS CodeCoverageReportSummary
ReadS [CodeCoverageReportSummary]
(Int -> ReadS CodeCoverageReportSummary)
-> ReadS [CodeCoverageReportSummary]
-> ReadPrec CodeCoverageReportSummary
-> ReadPrec [CodeCoverageReportSummary]
-> Read CodeCoverageReportSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CodeCoverageReportSummary]
$creadListPrec :: ReadPrec [CodeCoverageReportSummary]
readPrec :: ReadPrec CodeCoverageReportSummary
$creadPrec :: ReadPrec CodeCoverageReportSummary
readList :: ReadS [CodeCoverageReportSummary]
$creadList :: ReadS [CodeCoverageReportSummary]
readsPrec :: Int -> ReadS CodeCoverageReportSummary
$creadsPrec :: Int -> ReadS CodeCoverageReportSummary
Prelude.Read, Int -> CodeCoverageReportSummary -> ShowS
[CodeCoverageReportSummary] -> ShowS
CodeCoverageReportSummary -> String
(Int -> CodeCoverageReportSummary -> ShowS)
-> (CodeCoverageReportSummary -> String)
-> ([CodeCoverageReportSummary] -> ShowS)
-> Show CodeCoverageReportSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CodeCoverageReportSummary] -> ShowS
$cshowList :: [CodeCoverageReportSummary] -> ShowS
show :: CodeCoverageReportSummary -> String
$cshow :: CodeCoverageReportSummary -> String
showsPrec :: Int -> CodeCoverageReportSummary -> ShowS
$cshowsPrec :: Int -> CodeCoverageReportSummary -> ShowS
Prelude.Show, (forall x.
 CodeCoverageReportSummary -> Rep CodeCoverageReportSummary x)
-> (forall x.
    Rep CodeCoverageReportSummary x -> CodeCoverageReportSummary)
-> Generic CodeCoverageReportSummary
forall x.
Rep CodeCoverageReportSummary x -> CodeCoverageReportSummary
forall x.
CodeCoverageReportSummary -> Rep CodeCoverageReportSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CodeCoverageReportSummary x -> CodeCoverageReportSummary
$cfrom :: forall x.
CodeCoverageReportSummary -> Rep CodeCoverageReportSummary x
Prelude.Generic)

-- |
-- Create a value of 'CodeCoverageReportSummary' 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:
--
-- 'branchesMissed', 'codeCoverageReportSummary_branchesMissed' - The number of conditional branches that are not covered by your tests.
--
-- 'linesMissed', 'codeCoverageReportSummary_linesMissed' - The number of lines that are not covered by your tests.
--
-- 'branchesCovered', 'codeCoverageReportSummary_branchesCovered' - The number of conditional branches that are covered by your tests.
--
-- 'linesCovered', 'codeCoverageReportSummary_linesCovered' - The number of lines that are covered by your tests.
--
-- 'branchCoveragePercentage', 'codeCoverageReportSummary_branchCoveragePercentage' - The percentage of branches that are covered by your tests.
--
-- 'lineCoveragePercentage', 'codeCoverageReportSummary_lineCoveragePercentage' - The percentage of lines that are covered by your tests.
newCodeCoverageReportSummary ::
  CodeCoverageReportSummary
newCodeCoverageReportSummary :: CodeCoverageReportSummary
newCodeCoverageReportSummary =
  CodeCoverageReportSummary' :: Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Double
-> Maybe Double
-> CodeCoverageReportSummary
CodeCoverageReportSummary'
    { $sel:branchesMissed:CodeCoverageReportSummary' :: Maybe Natural
branchesMissed =
        Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:linesMissed:CodeCoverageReportSummary' :: Maybe Natural
linesMissed = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:branchesCovered:CodeCoverageReportSummary' :: Maybe Natural
branchesCovered = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:linesCovered:CodeCoverageReportSummary' :: Maybe Natural
linesCovered = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:branchCoveragePercentage:CodeCoverageReportSummary' :: Maybe Double
branchCoveragePercentage = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:lineCoveragePercentage:CodeCoverageReportSummary' :: Maybe Double
lineCoveragePercentage = Maybe Double
forall a. Maybe a
Prelude.Nothing
    }

-- | The number of conditional branches that are not covered by your tests.
codeCoverageReportSummary_branchesMissed :: Lens.Lens' CodeCoverageReportSummary (Prelude.Maybe Prelude.Natural)
codeCoverageReportSummary_branchesMissed :: (Maybe Natural -> f (Maybe Natural))
-> CodeCoverageReportSummary -> f CodeCoverageReportSummary
codeCoverageReportSummary_branchesMissed = (CodeCoverageReportSummary -> Maybe Natural)
-> (CodeCoverageReportSummary
    -> Maybe Natural -> CodeCoverageReportSummary)
-> Lens
     CodeCoverageReportSummary
     CodeCoverageReportSummary
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CodeCoverageReportSummary' {Maybe Natural
branchesMissed :: Maybe Natural
$sel:branchesMissed:CodeCoverageReportSummary' :: CodeCoverageReportSummary -> Maybe Natural
branchesMissed} -> Maybe Natural
branchesMissed) (\s :: CodeCoverageReportSummary
s@CodeCoverageReportSummary' {} Maybe Natural
a -> CodeCoverageReportSummary
s {$sel:branchesMissed:CodeCoverageReportSummary' :: Maybe Natural
branchesMissed = Maybe Natural
a} :: CodeCoverageReportSummary)

-- | The number of lines that are not covered by your tests.
codeCoverageReportSummary_linesMissed :: Lens.Lens' CodeCoverageReportSummary (Prelude.Maybe Prelude.Natural)
codeCoverageReportSummary_linesMissed :: (Maybe Natural -> f (Maybe Natural))
-> CodeCoverageReportSummary -> f CodeCoverageReportSummary
codeCoverageReportSummary_linesMissed = (CodeCoverageReportSummary -> Maybe Natural)
-> (CodeCoverageReportSummary
    -> Maybe Natural -> CodeCoverageReportSummary)
-> Lens
     CodeCoverageReportSummary
     CodeCoverageReportSummary
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CodeCoverageReportSummary' {Maybe Natural
linesMissed :: Maybe Natural
$sel:linesMissed:CodeCoverageReportSummary' :: CodeCoverageReportSummary -> Maybe Natural
linesMissed} -> Maybe Natural
linesMissed) (\s :: CodeCoverageReportSummary
s@CodeCoverageReportSummary' {} Maybe Natural
a -> CodeCoverageReportSummary
s {$sel:linesMissed:CodeCoverageReportSummary' :: Maybe Natural
linesMissed = Maybe Natural
a} :: CodeCoverageReportSummary)

-- | The number of conditional branches that are covered by your tests.
codeCoverageReportSummary_branchesCovered :: Lens.Lens' CodeCoverageReportSummary (Prelude.Maybe Prelude.Natural)
codeCoverageReportSummary_branchesCovered :: (Maybe Natural -> f (Maybe Natural))
-> CodeCoverageReportSummary -> f CodeCoverageReportSummary
codeCoverageReportSummary_branchesCovered = (CodeCoverageReportSummary -> Maybe Natural)
-> (CodeCoverageReportSummary
    -> Maybe Natural -> CodeCoverageReportSummary)
-> Lens
     CodeCoverageReportSummary
     CodeCoverageReportSummary
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CodeCoverageReportSummary' {Maybe Natural
branchesCovered :: Maybe Natural
$sel:branchesCovered:CodeCoverageReportSummary' :: CodeCoverageReportSummary -> Maybe Natural
branchesCovered} -> Maybe Natural
branchesCovered) (\s :: CodeCoverageReportSummary
s@CodeCoverageReportSummary' {} Maybe Natural
a -> CodeCoverageReportSummary
s {$sel:branchesCovered:CodeCoverageReportSummary' :: Maybe Natural
branchesCovered = Maybe Natural
a} :: CodeCoverageReportSummary)

-- | The number of lines that are covered by your tests.
codeCoverageReportSummary_linesCovered :: Lens.Lens' CodeCoverageReportSummary (Prelude.Maybe Prelude.Natural)
codeCoverageReportSummary_linesCovered :: (Maybe Natural -> f (Maybe Natural))
-> CodeCoverageReportSummary -> f CodeCoverageReportSummary
codeCoverageReportSummary_linesCovered = (CodeCoverageReportSummary -> Maybe Natural)
-> (CodeCoverageReportSummary
    -> Maybe Natural -> CodeCoverageReportSummary)
-> Lens
     CodeCoverageReportSummary
     CodeCoverageReportSummary
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CodeCoverageReportSummary' {Maybe Natural
linesCovered :: Maybe Natural
$sel:linesCovered:CodeCoverageReportSummary' :: CodeCoverageReportSummary -> Maybe Natural
linesCovered} -> Maybe Natural
linesCovered) (\s :: CodeCoverageReportSummary
s@CodeCoverageReportSummary' {} Maybe Natural
a -> CodeCoverageReportSummary
s {$sel:linesCovered:CodeCoverageReportSummary' :: Maybe Natural
linesCovered = Maybe Natural
a} :: CodeCoverageReportSummary)

-- | The percentage of branches that are covered by your tests.
codeCoverageReportSummary_branchCoveragePercentage :: Lens.Lens' CodeCoverageReportSummary (Prelude.Maybe Prelude.Double)
codeCoverageReportSummary_branchCoveragePercentage :: (Maybe Double -> f (Maybe Double))
-> CodeCoverageReportSummary -> f CodeCoverageReportSummary
codeCoverageReportSummary_branchCoveragePercentage = (CodeCoverageReportSummary -> Maybe Double)
-> (CodeCoverageReportSummary
    -> Maybe Double -> CodeCoverageReportSummary)
-> Lens
     CodeCoverageReportSummary
     CodeCoverageReportSummary
     (Maybe Double)
     (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CodeCoverageReportSummary' {Maybe Double
branchCoveragePercentage :: Maybe Double
$sel:branchCoveragePercentage:CodeCoverageReportSummary' :: CodeCoverageReportSummary -> Maybe Double
branchCoveragePercentage} -> Maybe Double
branchCoveragePercentage) (\s :: CodeCoverageReportSummary
s@CodeCoverageReportSummary' {} Maybe Double
a -> CodeCoverageReportSummary
s {$sel:branchCoveragePercentage:CodeCoverageReportSummary' :: Maybe Double
branchCoveragePercentage = Maybe Double
a} :: CodeCoverageReportSummary)

-- | The percentage of lines that are covered by your tests.
codeCoverageReportSummary_lineCoveragePercentage :: Lens.Lens' CodeCoverageReportSummary (Prelude.Maybe Prelude.Double)
codeCoverageReportSummary_lineCoveragePercentage :: (Maybe Double -> f (Maybe Double))
-> CodeCoverageReportSummary -> f CodeCoverageReportSummary
codeCoverageReportSummary_lineCoveragePercentage = (CodeCoverageReportSummary -> Maybe Double)
-> (CodeCoverageReportSummary
    -> Maybe Double -> CodeCoverageReportSummary)
-> Lens
     CodeCoverageReportSummary
     CodeCoverageReportSummary
     (Maybe Double)
     (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CodeCoverageReportSummary' {Maybe Double
lineCoveragePercentage :: Maybe Double
$sel:lineCoveragePercentage:CodeCoverageReportSummary' :: CodeCoverageReportSummary -> Maybe Double
lineCoveragePercentage} -> Maybe Double
lineCoveragePercentage) (\s :: CodeCoverageReportSummary
s@CodeCoverageReportSummary' {} Maybe Double
a -> CodeCoverageReportSummary
s {$sel:lineCoveragePercentage:CodeCoverageReportSummary' :: Maybe Double
lineCoveragePercentage = Maybe Double
a} :: CodeCoverageReportSummary)

instance Core.FromJSON CodeCoverageReportSummary where
  parseJSON :: Value -> Parser CodeCoverageReportSummary
parseJSON =
    String
-> (Object -> Parser CodeCoverageReportSummary)
-> Value
-> Parser CodeCoverageReportSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"CodeCoverageReportSummary"
      ( \Object
x ->
          Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Double
-> Maybe Double
-> CodeCoverageReportSummary
CodeCoverageReportSummary'
            (Maybe Natural
 -> Maybe Natural
 -> Maybe Natural
 -> Maybe Natural
 -> Maybe Double
 -> Maybe Double
 -> CodeCoverageReportSummary)
-> Parser (Maybe Natural)
-> Parser
     (Maybe Natural
      -> Maybe Natural
      -> Maybe Natural
      -> Maybe Double
      -> Maybe Double
      -> CodeCoverageReportSummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"branchesMissed")
            Parser
  (Maybe Natural
   -> Maybe Natural
   -> Maybe Natural
   -> Maybe Double
   -> Maybe Double
   -> CodeCoverageReportSummary)
-> Parser (Maybe Natural)
-> Parser
     (Maybe Natural
      -> Maybe Natural
      -> Maybe Double
      -> Maybe Double
      -> CodeCoverageReportSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"linesMissed")
            Parser
  (Maybe Natural
   -> Maybe Natural
   -> Maybe Double
   -> Maybe Double
   -> CodeCoverageReportSummary)
-> Parser (Maybe Natural)
-> Parser
     (Maybe Natural
      -> Maybe Double -> Maybe Double -> CodeCoverageReportSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"branchesCovered")
            Parser
  (Maybe Natural
   -> Maybe Double -> Maybe Double -> CodeCoverageReportSummary)
-> Parser (Maybe Natural)
-> Parser
     (Maybe Double -> Maybe Double -> CodeCoverageReportSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"linesCovered")
            Parser (Maybe Double -> Maybe Double -> CodeCoverageReportSummary)
-> Parser (Maybe Double)
-> Parser (Maybe Double -> CodeCoverageReportSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"branchCoveragePercentage")
            Parser (Maybe Double -> CodeCoverageReportSummary)
-> Parser (Maybe Double) -> Parser CodeCoverageReportSummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"lineCoveragePercentage")
      )

instance Prelude.Hashable CodeCoverageReportSummary

instance Prelude.NFData CodeCoverageReportSummary