{-# 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.ECR.Types.ScoreDetails
-- 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.ECR.Types.ScoreDetails where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.ECR.Types.CvssScoreDetails
import qualified Amazonka.Prelude as Prelude

-- | Information about the Amazon Inspector score given to a finding.
--
-- /See:/ 'newScoreDetails' smart constructor.
data ScoreDetails = ScoreDetails'
  { -- | An object that contains details about the CVSS score given to a finding.
    ScoreDetails -> Maybe CvssScoreDetails
cvss :: Prelude.Maybe CvssScoreDetails
  }
  deriving (ScoreDetails -> ScoreDetails -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ScoreDetails -> ScoreDetails -> Bool
$c/= :: ScoreDetails -> ScoreDetails -> Bool
== :: ScoreDetails -> ScoreDetails -> Bool
$c== :: ScoreDetails -> ScoreDetails -> Bool
Prelude.Eq, ReadPrec [ScoreDetails]
ReadPrec ScoreDetails
Int -> ReadS ScoreDetails
ReadS [ScoreDetails]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ScoreDetails]
$creadListPrec :: ReadPrec [ScoreDetails]
readPrec :: ReadPrec ScoreDetails
$creadPrec :: ReadPrec ScoreDetails
readList :: ReadS [ScoreDetails]
$creadList :: ReadS [ScoreDetails]
readsPrec :: Int -> ReadS ScoreDetails
$creadsPrec :: Int -> ReadS ScoreDetails
Prelude.Read, Int -> ScoreDetails -> ShowS
[ScoreDetails] -> ShowS
ScoreDetails -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ScoreDetails] -> ShowS
$cshowList :: [ScoreDetails] -> ShowS
show :: ScoreDetails -> String
$cshow :: ScoreDetails -> String
showsPrec :: Int -> ScoreDetails -> ShowS
$cshowsPrec :: Int -> ScoreDetails -> ShowS
Prelude.Show, forall x. Rep ScoreDetails x -> ScoreDetails
forall x. ScoreDetails -> Rep ScoreDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ScoreDetails x -> ScoreDetails
$cfrom :: forall x. ScoreDetails -> Rep ScoreDetails x
Prelude.Generic)

-- |
-- Create a value of 'ScoreDetails' 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:
--
-- 'cvss', 'scoreDetails_cvss' - An object that contains details about the CVSS score given to a finding.
newScoreDetails ::
  ScoreDetails
newScoreDetails :: ScoreDetails
newScoreDetails =
  ScoreDetails' {$sel:cvss:ScoreDetails' :: Maybe CvssScoreDetails
cvss = forall a. Maybe a
Prelude.Nothing}

-- | An object that contains details about the CVSS score given to a finding.
scoreDetails_cvss :: Lens.Lens' ScoreDetails (Prelude.Maybe CvssScoreDetails)
scoreDetails_cvss :: Lens' ScoreDetails (Maybe CvssScoreDetails)
scoreDetails_cvss = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScoreDetails' {Maybe CvssScoreDetails
cvss :: Maybe CvssScoreDetails
$sel:cvss:ScoreDetails' :: ScoreDetails -> Maybe CvssScoreDetails
cvss} -> Maybe CvssScoreDetails
cvss) (\s :: ScoreDetails
s@ScoreDetails' {} Maybe CvssScoreDetails
a -> ScoreDetails
s {$sel:cvss:ScoreDetails' :: Maybe CvssScoreDetails
cvss = Maybe CvssScoreDetails
a} :: ScoreDetails)

instance Data.FromJSON ScoreDetails where
  parseJSON :: Value -> Parser ScoreDetails
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ScoreDetails"
      ( \Object
x ->
          Maybe CvssScoreDetails -> ScoreDetails
ScoreDetails' 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
"cvss")
      )

instance Prelude.Hashable ScoreDetails where
  hashWithSalt :: Int -> ScoreDetails -> Int
hashWithSalt Int
_salt ScoreDetails' {Maybe CvssScoreDetails
cvss :: Maybe CvssScoreDetails
$sel:cvss:ScoreDetails' :: ScoreDetails -> Maybe CvssScoreDetails
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CvssScoreDetails
cvss

instance Prelude.NFData ScoreDetails where
  rnf :: ScoreDetails -> ()
rnf ScoreDetails' {Maybe CvssScoreDetails
cvss :: Maybe CvssScoreDetails
$sel:cvss:ScoreDetails' :: ScoreDetails -> Maybe CvssScoreDetails
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe CvssScoreDetails
cvss