{-# 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.Inspector2.Types.ScanStatus
-- 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.Inspector2.Types.ScanStatus where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Inspector2.Types.ScanStatusCode
import Amazonka.Inspector2.Types.ScanStatusReason
import qualified Amazonka.Prelude as Prelude

-- | The status of the scan.
--
-- /See:/ 'newScanStatus' smart constructor.
data ScanStatus = ScanStatus'
  { -- | The reason for the scan.
    ScanStatus -> ScanStatusReason
reason :: ScanStatusReason,
    -- | The status code of the scan.
    ScanStatus -> ScanStatusCode
statusCode :: ScanStatusCode
  }
  deriving (ScanStatus -> ScanStatus -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ScanStatus -> ScanStatus -> Bool
$c/= :: ScanStatus -> ScanStatus -> Bool
== :: ScanStatus -> ScanStatus -> Bool
$c== :: ScanStatus -> ScanStatus -> Bool
Prelude.Eq, ReadPrec [ScanStatus]
ReadPrec ScanStatus
Int -> ReadS ScanStatus
ReadS [ScanStatus]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ScanStatus]
$creadListPrec :: ReadPrec [ScanStatus]
readPrec :: ReadPrec ScanStatus
$creadPrec :: ReadPrec ScanStatus
readList :: ReadS [ScanStatus]
$creadList :: ReadS [ScanStatus]
readsPrec :: Int -> ReadS ScanStatus
$creadsPrec :: Int -> ReadS ScanStatus
Prelude.Read, Int -> ScanStatus -> ShowS
[ScanStatus] -> ShowS
ScanStatus -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ScanStatus] -> ShowS
$cshowList :: [ScanStatus] -> ShowS
show :: ScanStatus -> String
$cshow :: ScanStatus -> String
showsPrec :: Int -> ScanStatus -> ShowS
$cshowsPrec :: Int -> ScanStatus -> ShowS
Prelude.Show, forall x. Rep ScanStatus x -> ScanStatus
forall x. ScanStatus -> Rep ScanStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ScanStatus x -> ScanStatus
$cfrom :: forall x. ScanStatus -> Rep ScanStatus x
Prelude.Generic)

-- |
-- Create a value of 'ScanStatus' 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', 'scanStatus_reason' - The reason for the scan.
--
-- 'statusCode', 'scanStatus_statusCode' - The status code of the scan.
newScanStatus ::
  -- | 'reason'
  ScanStatusReason ->
  -- | 'statusCode'
  ScanStatusCode ->
  ScanStatus
newScanStatus :: ScanStatusReason -> ScanStatusCode -> ScanStatus
newScanStatus ScanStatusReason
pReason_ ScanStatusCode
pStatusCode_ =
  ScanStatus'
    { $sel:reason:ScanStatus' :: ScanStatusReason
reason = ScanStatusReason
pReason_,
      $sel:statusCode:ScanStatus' :: ScanStatusCode
statusCode = ScanStatusCode
pStatusCode_
    }

-- | The reason for the scan.
scanStatus_reason :: Lens.Lens' ScanStatus ScanStatusReason
scanStatus_reason :: Lens' ScanStatus ScanStatusReason
scanStatus_reason = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScanStatus' {ScanStatusReason
reason :: ScanStatusReason
$sel:reason:ScanStatus' :: ScanStatus -> ScanStatusReason
reason} -> ScanStatusReason
reason) (\s :: ScanStatus
s@ScanStatus' {} ScanStatusReason
a -> ScanStatus
s {$sel:reason:ScanStatus' :: ScanStatusReason
reason = ScanStatusReason
a} :: ScanStatus)

-- | The status code of the scan.
scanStatus_statusCode :: Lens.Lens' ScanStatus ScanStatusCode
scanStatus_statusCode :: Lens' ScanStatus ScanStatusCode
scanStatus_statusCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScanStatus' {ScanStatusCode
statusCode :: ScanStatusCode
$sel:statusCode:ScanStatus' :: ScanStatus -> ScanStatusCode
statusCode} -> ScanStatusCode
statusCode) (\s :: ScanStatus
s@ScanStatus' {} ScanStatusCode
a -> ScanStatus
s {$sel:statusCode:ScanStatus' :: ScanStatusCode
statusCode = ScanStatusCode
a} :: ScanStatus)

instance Data.FromJSON ScanStatus where
  parseJSON :: Value -> Parser ScanStatus
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ScanStatus"
      ( \Object
x ->
          ScanStatusReason -> ScanStatusCode -> ScanStatus
ScanStatus'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"reason")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"statusCode")
      )

instance Prelude.Hashable ScanStatus where
  hashWithSalt :: Int -> ScanStatus -> Int
hashWithSalt Int
_salt ScanStatus' {ScanStatusCode
ScanStatusReason
statusCode :: ScanStatusCode
reason :: ScanStatusReason
$sel:statusCode:ScanStatus' :: ScanStatus -> ScanStatusCode
$sel:reason:ScanStatus' :: ScanStatus -> ScanStatusReason
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ScanStatusReason
reason
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ScanStatusCode
statusCode

instance Prelude.NFData ScanStatus where
  rnf :: ScanStatus -> ()
rnf ScanStatus' {ScanStatusCode
ScanStatusReason
statusCode :: ScanStatusCode
reason :: ScanStatusReason
$sel:statusCode:ScanStatus' :: ScanStatus -> ScanStatusCode
$sel:reason:ScanStatus' :: ScanStatus -> ScanStatusReason
..} =
    forall a. NFData a => a -> ()
Prelude.rnf ScanStatusReason
reason
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ScanStatusCode
statusCode