{-# 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.SecurityHub.Types.ClassificationStatus
-- 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.SecurityHub.Types.ClassificationStatus where

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

-- | Provides details about the current status of the sensitive data
-- detection.
--
-- /See:/ 'newClassificationStatus' smart constructor.
data ClassificationStatus = ClassificationStatus'
  { -- | A longer description of the current status of the sensitive data
    -- detection.
    ClassificationStatus -> Maybe Text
reason :: Prelude.Maybe Prelude.Text,
    -- | The code that represents the status of the sensitive data detection.
    ClassificationStatus -> Maybe Text
code :: Prelude.Maybe Prelude.Text
  }
  deriving (ClassificationStatus -> ClassificationStatus -> Bool
(ClassificationStatus -> ClassificationStatus -> Bool)
-> (ClassificationStatus -> ClassificationStatus -> Bool)
-> Eq ClassificationStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ClassificationStatus -> ClassificationStatus -> Bool
$c/= :: ClassificationStatus -> ClassificationStatus -> Bool
== :: ClassificationStatus -> ClassificationStatus -> Bool
$c== :: ClassificationStatus -> ClassificationStatus -> Bool
Prelude.Eq, ReadPrec [ClassificationStatus]
ReadPrec ClassificationStatus
Int -> ReadS ClassificationStatus
ReadS [ClassificationStatus]
(Int -> ReadS ClassificationStatus)
-> ReadS [ClassificationStatus]
-> ReadPrec ClassificationStatus
-> ReadPrec [ClassificationStatus]
-> Read ClassificationStatus
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ClassificationStatus]
$creadListPrec :: ReadPrec [ClassificationStatus]
readPrec :: ReadPrec ClassificationStatus
$creadPrec :: ReadPrec ClassificationStatus
readList :: ReadS [ClassificationStatus]
$creadList :: ReadS [ClassificationStatus]
readsPrec :: Int -> ReadS ClassificationStatus
$creadsPrec :: Int -> ReadS ClassificationStatus
Prelude.Read, Int -> ClassificationStatus -> ShowS
[ClassificationStatus] -> ShowS
ClassificationStatus -> String
(Int -> ClassificationStatus -> ShowS)
-> (ClassificationStatus -> String)
-> ([ClassificationStatus] -> ShowS)
-> Show ClassificationStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ClassificationStatus] -> ShowS
$cshowList :: [ClassificationStatus] -> ShowS
show :: ClassificationStatus -> String
$cshow :: ClassificationStatus -> String
showsPrec :: Int -> ClassificationStatus -> ShowS
$cshowsPrec :: Int -> ClassificationStatus -> ShowS
Prelude.Show, (forall x. ClassificationStatus -> Rep ClassificationStatus x)
-> (forall x. Rep ClassificationStatus x -> ClassificationStatus)
-> Generic ClassificationStatus
forall x. Rep ClassificationStatus x -> ClassificationStatus
forall x. ClassificationStatus -> Rep ClassificationStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ClassificationStatus x -> ClassificationStatus
$cfrom :: forall x. ClassificationStatus -> Rep ClassificationStatus x
Prelude.Generic)

-- |
-- Create a value of 'ClassificationStatus' 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:
--
-- 'reason', 'classificationStatus_reason' - A longer description of the current status of the sensitive data
-- detection.
--
-- 'code', 'classificationStatus_code' - The code that represents the status of the sensitive data detection.
newClassificationStatus ::
  ClassificationStatus
newClassificationStatus :: ClassificationStatus
newClassificationStatus =
  ClassificationStatus' :: Maybe Text -> Maybe Text -> ClassificationStatus
ClassificationStatus'
    { $sel:reason:ClassificationStatus' :: Maybe Text
reason = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:code:ClassificationStatus' :: Maybe Text
code = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | A longer description of the current status of the sensitive data
-- detection.
classificationStatus_reason :: Lens.Lens' ClassificationStatus (Prelude.Maybe Prelude.Text)
classificationStatus_reason :: (Maybe Text -> f (Maybe Text))
-> ClassificationStatus -> f ClassificationStatus
classificationStatus_reason = (ClassificationStatus -> Maybe Text)
-> (ClassificationStatus -> Maybe Text -> ClassificationStatus)
-> Lens
     ClassificationStatus ClassificationStatus (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClassificationStatus' {Maybe Text
reason :: Maybe Text
$sel:reason:ClassificationStatus' :: ClassificationStatus -> Maybe Text
reason} -> Maybe Text
reason) (\s :: ClassificationStatus
s@ClassificationStatus' {} Maybe Text
a -> ClassificationStatus
s {$sel:reason:ClassificationStatus' :: Maybe Text
reason = Maybe Text
a} :: ClassificationStatus)

-- | The code that represents the status of the sensitive data detection.
classificationStatus_code :: Lens.Lens' ClassificationStatus (Prelude.Maybe Prelude.Text)
classificationStatus_code :: (Maybe Text -> f (Maybe Text))
-> ClassificationStatus -> f ClassificationStatus
classificationStatus_code = (ClassificationStatus -> Maybe Text)
-> (ClassificationStatus -> Maybe Text -> ClassificationStatus)
-> Lens
     ClassificationStatus ClassificationStatus (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClassificationStatus' {Maybe Text
code :: Maybe Text
$sel:code:ClassificationStatus' :: ClassificationStatus -> Maybe Text
code} -> Maybe Text
code) (\s :: ClassificationStatus
s@ClassificationStatus' {} Maybe Text
a -> ClassificationStatus
s {$sel:code:ClassificationStatus' :: Maybe Text
code = Maybe Text
a} :: ClassificationStatus)

instance Core.FromJSON ClassificationStatus where
  parseJSON :: Value -> Parser ClassificationStatus
parseJSON =
    String
-> (Object -> Parser ClassificationStatus)
-> Value
-> Parser ClassificationStatus
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ClassificationStatus"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> ClassificationStatus
ClassificationStatus'
            (Maybe Text -> Maybe Text -> ClassificationStatus)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> ClassificationStatus)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Reason")
            Parser (Maybe Text -> ClassificationStatus)
-> Parser (Maybe Text) -> Parser ClassificationStatus
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Code")
      )

instance Prelude.Hashable ClassificationStatus

instance Prelude.NFData ClassificationStatus

instance Core.ToJSON ClassificationStatus where
  toJSON :: ClassificationStatus -> Value
toJSON ClassificationStatus' {Maybe Text
code :: Maybe Text
reason :: Maybe Text
$sel:code:ClassificationStatus' :: ClassificationStatus -> Maybe Text
$sel:reason:ClassificationStatus' :: ClassificationStatus -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Reason" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
reason,
            (Text
"Code" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
code
          ]
      )