{-# 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.AuditManager.Types.ControlInsightsMetadataItem
-- 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.AuditManager.Types.ControlInsightsMetadataItem where

import Amazonka.AuditManager.Types.EvidenceInsights
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

-- | A summary of the latest analytics data for a specific control.
--
-- This data reflects the total counts for the specified control across all
-- active assessments. Control insights are grouped by control domain, and
-- ranked by the highest total count of non-compliant evidence.
--
-- /See:/ 'newControlInsightsMetadataItem' smart constructor.
data ControlInsightsMetadataItem = ControlInsightsMetadataItem'
  { -- | A breakdown of the compliance check status for the evidence that’s
    -- associated with the control.
    ControlInsightsMetadataItem -> Maybe EvidenceInsights
evidenceInsights :: Prelude.Maybe EvidenceInsights,
    -- | The unique identifier for the control.
    ControlInsightsMetadataItem -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The time when the control insights were last updated.
    ControlInsightsMetadataItem -> Maybe POSIX
lastUpdated :: Prelude.Maybe Data.POSIX,
    -- | The name of the control.
    ControlInsightsMetadataItem -> Maybe Text
name :: Prelude.Maybe Prelude.Text
  }
  deriving (ControlInsightsMetadataItem -> ControlInsightsMetadataItem -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ControlInsightsMetadataItem -> ControlInsightsMetadataItem -> Bool
$c/= :: ControlInsightsMetadataItem -> ControlInsightsMetadataItem -> Bool
== :: ControlInsightsMetadataItem -> ControlInsightsMetadataItem -> Bool
$c== :: ControlInsightsMetadataItem -> ControlInsightsMetadataItem -> Bool
Prelude.Eq, ReadPrec [ControlInsightsMetadataItem]
ReadPrec ControlInsightsMetadataItem
Int -> ReadS ControlInsightsMetadataItem
ReadS [ControlInsightsMetadataItem]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ControlInsightsMetadataItem]
$creadListPrec :: ReadPrec [ControlInsightsMetadataItem]
readPrec :: ReadPrec ControlInsightsMetadataItem
$creadPrec :: ReadPrec ControlInsightsMetadataItem
readList :: ReadS [ControlInsightsMetadataItem]
$creadList :: ReadS [ControlInsightsMetadataItem]
readsPrec :: Int -> ReadS ControlInsightsMetadataItem
$creadsPrec :: Int -> ReadS ControlInsightsMetadataItem
Prelude.Read, Int -> ControlInsightsMetadataItem -> ShowS
[ControlInsightsMetadataItem] -> ShowS
ControlInsightsMetadataItem -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ControlInsightsMetadataItem] -> ShowS
$cshowList :: [ControlInsightsMetadataItem] -> ShowS
show :: ControlInsightsMetadataItem -> String
$cshow :: ControlInsightsMetadataItem -> String
showsPrec :: Int -> ControlInsightsMetadataItem -> ShowS
$cshowsPrec :: Int -> ControlInsightsMetadataItem -> ShowS
Prelude.Show, forall x.
Rep ControlInsightsMetadataItem x -> ControlInsightsMetadataItem
forall x.
ControlInsightsMetadataItem -> Rep ControlInsightsMetadataItem x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ControlInsightsMetadataItem x -> ControlInsightsMetadataItem
$cfrom :: forall x.
ControlInsightsMetadataItem -> Rep ControlInsightsMetadataItem x
Prelude.Generic)

-- |
-- Create a value of 'ControlInsightsMetadataItem' 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:
--
-- 'evidenceInsights', 'controlInsightsMetadataItem_evidenceInsights' - A breakdown of the compliance check status for the evidence that’s
-- associated with the control.
--
-- 'id', 'controlInsightsMetadataItem_id' - The unique identifier for the control.
--
-- 'lastUpdated', 'controlInsightsMetadataItem_lastUpdated' - The time when the control insights were last updated.
--
-- 'name', 'controlInsightsMetadataItem_name' - The name of the control.
newControlInsightsMetadataItem ::
  ControlInsightsMetadataItem
newControlInsightsMetadataItem :: ControlInsightsMetadataItem
newControlInsightsMetadataItem =
  ControlInsightsMetadataItem'
    { $sel:evidenceInsights:ControlInsightsMetadataItem' :: Maybe EvidenceInsights
evidenceInsights =
        forall a. Maybe a
Prelude.Nothing,
      $sel:id:ControlInsightsMetadataItem' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdated:ControlInsightsMetadataItem' :: Maybe POSIX
lastUpdated = forall a. Maybe a
Prelude.Nothing,
      $sel:name:ControlInsightsMetadataItem' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing
    }

-- | A breakdown of the compliance check status for the evidence that’s
-- associated with the control.
controlInsightsMetadataItem_evidenceInsights :: Lens.Lens' ControlInsightsMetadataItem (Prelude.Maybe EvidenceInsights)
controlInsightsMetadataItem_evidenceInsights :: Lens' ControlInsightsMetadataItem (Maybe EvidenceInsights)
controlInsightsMetadataItem_evidenceInsights = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ControlInsightsMetadataItem' {Maybe EvidenceInsights
evidenceInsights :: Maybe EvidenceInsights
$sel:evidenceInsights:ControlInsightsMetadataItem' :: ControlInsightsMetadataItem -> Maybe EvidenceInsights
evidenceInsights} -> Maybe EvidenceInsights
evidenceInsights) (\s :: ControlInsightsMetadataItem
s@ControlInsightsMetadataItem' {} Maybe EvidenceInsights
a -> ControlInsightsMetadataItem
s {$sel:evidenceInsights:ControlInsightsMetadataItem' :: Maybe EvidenceInsights
evidenceInsights = Maybe EvidenceInsights
a} :: ControlInsightsMetadataItem)

-- | The unique identifier for the control.
controlInsightsMetadataItem_id :: Lens.Lens' ControlInsightsMetadataItem (Prelude.Maybe Prelude.Text)
controlInsightsMetadataItem_id :: Lens' ControlInsightsMetadataItem (Maybe Text)
controlInsightsMetadataItem_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ControlInsightsMetadataItem' {Maybe Text
id :: Maybe Text
$sel:id:ControlInsightsMetadataItem' :: ControlInsightsMetadataItem -> Maybe Text
id} -> Maybe Text
id) (\s :: ControlInsightsMetadataItem
s@ControlInsightsMetadataItem' {} Maybe Text
a -> ControlInsightsMetadataItem
s {$sel:id:ControlInsightsMetadataItem' :: Maybe Text
id = Maybe Text
a} :: ControlInsightsMetadataItem)

-- | The time when the control insights were last updated.
controlInsightsMetadataItem_lastUpdated :: Lens.Lens' ControlInsightsMetadataItem (Prelude.Maybe Prelude.UTCTime)
controlInsightsMetadataItem_lastUpdated :: Lens' ControlInsightsMetadataItem (Maybe UTCTime)
controlInsightsMetadataItem_lastUpdated = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ControlInsightsMetadataItem' {Maybe POSIX
lastUpdated :: Maybe POSIX
$sel:lastUpdated:ControlInsightsMetadataItem' :: ControlInsightsMetadataItem -> Maybe POSIX
lastUpdated} -> Maybe POSIX
lastUpdated) (\s :: ControlInsightsMetadataItem
s@ControlInsightsMetadataItem' {} Maybe POSIX
a -> ControlInsightsMetadataItem
s {$sel:lastUpdated:ControlInsightsMetadataItem' :: Maybe POSIX
lastUpdated = Maybe POSIX
a} :: ControlInsightsMetadataItem) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The name of the control.
controlInsightsMetadataItem_name :: Lens.Lens' ControlInsightsMetadataItem (Prelude.Maybe Prelude.Text)
controlInsightsMetadataItem_name :: Lens' ControlInsightsMetadataItem (Maybe Text)
controlInsightsMetadataItem_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ControlInsightsMetadataItem' {Maybe Text
name :: Maybe Text
$sel:name:ControlInsightsMetadataItem' :: ControlInsightsMetadataItem -> Maybe Text
name} -> Maybe Text
name) (\s :: ControlInsightsMetadataItem
s@ControlInsightsMetadataItem' {} Maybe Text
a -> ControlInsightsMetadataItem
s {$sel:name:ControlInsightsMetadataItem' :: Maybe Text
name = Maybe Text
a} :: ControlInsightsMetadataItem)

instance Data.FromJSON ControlInsightsMetadataItem where
  parseJSON :: Value -> Parser ControlInsightsMetadataItem
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ControlInsightsMetadataItem"
      ( \Object
x ->
          Maybe EvidenceInsights
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> ControlInsightsMetadataItem
ControlInsightsMetadataItem'
            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
"evidenceInsights")
            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
"id")
            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
"lastUpdated")
            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
"name")
      )

instance Prelude.Hashable ControlInsightsMetadataItem where
  hashWithSalt :: Int -> ControlInsightsMetadataItem -> Int
hashWithSalt Int
_salt ControlInsightsMetadataItem' {Maybe Text
Maybe POSIX
Maybe EvidenceInsights
name :: Maybe Text
lastUpdated :: Maybe POSIX
id :: Maybe Text
evidenceInsights :: Maybe EvidenceInsights
$sel:name:ControlInsightsMetadataItem' :: ControlInsightsMetadataItem -> Maybe Text
$sel:lastUpdated:ControlInsightsMetadataItem' :: ControlInsightsMetadataItem -> Maybe POSIX
$sel:id:ControlInsightsMetadataItem' :: ControlInsightsMetadataItem -> Maybe Text
$sel:evidenceInsights:ControlInsightsMetadataItem' :: ControlInsightsMetadataItem -> Maybe EvidenceInsights
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe EvidenceInsights
evidenceInsights
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastUpdated
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name

instance Prelude.NFData ControlInsightsMetadataItem where
  rnf :: ControlInsightsMetadataItem -> ()
rnf ControlInsightsMetadataItem' {Maybe Text
Maybe POSIX
Maybe EvidenceInsights
name :: Maybe Text
lastUpdated :: Maybe POSIX
id :: Maybe Text
evidenceInsights :: Maybe EvidenceInsights
$sel:name:ControlInsightsMetadataItem' :: ControlInsightsMetadataItem -> Maybe Text
$sel:lastUpdated:ControlInsightsMetadataItem' :: ControlInsightsMetadataItem -> Maybe POSIX
$sel:id:ControlInsightsMetadataItem' :: ControlInsightsMetadataItem -> Maybe Text
$sel:evidenceInsights:ControlInsightsMetadataItem' :: ControlInsightsMetadataItem -> Maybe EvidenceInsights
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe EvidenceInsights
evidenceInsights
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
id
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastUpdated
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name