{-# 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.IoT.Types.AuditTaskMetadata
-- 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.IoT.Types.AuditTaskMetadata where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoT.Types.AuditTaskStatus
import Amazonka.IoT.Types.AuditTaskType
import qualified Amazonka.Prelude as Prelude

-- | The audits that were performed.
--
-- /See:/ 'newAuditTaskMetadata' smart constructor.
data AuditTaskMetadata = AuditTaskMetadata'
  { -- | The ID of this audit.
    AuditTaskMetadata -> Maybe Text
taskId :: Prelude.Maybe Prelude.Text,
    -- | The status of this audit. One of \"IN_PROGRESS\", \"COMPLETED\",
    -- \"FAILED\", or \"CANCELED\".
    AuditTaskMetadata -> Maybe AuditTaskStatus
taskStatus :: Prelude.Maybe AuditTaskStatus,
    -- | The type of this audit. One of \"ON_DEMAND_AUDIT_TASK\" or
    -- \"SCHEDULED_AUDIT_TASK\".
    AuditTaskMetadata -> Maybe AuditTaskType
taskType :: Prelude.Maybe AuditTaskType
  }
  deriving (AuditTaskMetadata -> AuditTaskMetadata -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AuditTaskMetadata -> AuditTaskMetadata -> Bool
$c/= :: AuditTaskMetadata -> AuditTaskMetadata -> Bool
== :: AuditTaskMetadata -> AuditTaskMetadata -> Bool
$c== :: AuditTaskMetadata -> AuditTaskMetadata -> Bool
Prelude.Eq, ReadPrec [AuditTaskMetadata]
ReadPrec AuditTaskMetadata
Int -> ReadS AuditTaskMetadata
ReadS [AuditTaskMetadata]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AuditTaskMetadata]
$creadListPrec :: ReadPrec [AuditTaskMetadata]
readPrec :: ReadPrec AuditTaskMetadata
$creadPrec :: ReadPrec AuditTaskMetadata
readList :: ReadS [AuditTaskMetadata]
$creadList :: ReadS [AuditTaskMetadata]
readsPrec :: Int -> ReadS AuditTaskMetadata
$creadsPrec :: Int -> ReadS AuditTaskMetadata
Prelude.Read, Int -> AuditTaskMetadata -> ShowS
[AuditTaskMetadata] -> ShowS
AuditTaskMetadata -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AuditTaskMetadata] -> ShowS
$cshowList :: [AuditTaskMetadata] -> ShowS
show :: AuditTaskMetadata -> String
$cshow :: AuditTaskMetadata -> String
showsPrec :: Int -> AuditTaskMetadata -> ShowS
$cshowsPrec :: Int -> AuditTaskMetadata -> ShowS
Prelude.Show, forall x. Rep AuditTaskMetadata x -> AuditTaskMetadata
forall x. AuditTaskMetadata -> Rep AuditTaskMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AuditTaskMetadata x -> AuditTaskMetadata
$cfrom :: forall x. AuditTaskMetadata -> Rep AuditTaskMetadata x
Prelude.Generic)

-- |
-- Create a value of 'AuditTaskMetadata' 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:
--
-- 'taskId', 'auditTaskMetadata_taskId' - The ID of this audit.
--
-- 'taskStatus', 'auditTaskMetadata_taskStatus' - The status of this audit. One of \"IN_PROGRESS\", \"COMPLETED\",
-- \"FAILED\", or \"CANCELED\".
--
-- 'taskType', 'auditTaskMetadata_taskType' - The type of this audit. One of \"ON_DEMAND_AUDIT_TASK\" or
-- \"SCHEDULED_AUDIT_TASK\".
newAuditTaskMetadata ::
  AuditTaskMetadata
newAuditTaskMetadata :: AuditTaskMetadata
newAuditTaskMetadata =
  AuditTaskMetadata'
    { $sel:taskId:AuditTaskMetadata' :: Maybe Text
taskId = forall a. Maybe a
Prelude.Nothing,
      $sel:taskStatus:AuditTaskMetadata' :: Maybe AuditTaskStatus
taskStatus = forall a. Maybe a
Prelude.Nothing,
      $sel:taskType:AuditTaskMetadata' :: Maybe AuditTaskType
taskType = forall a. Maybe a
Prelude.Nothing
    }

-- | The ID of this audit.
auditTaskMetadata_taskId :: Lens.Lens' AuditTaskMetadata (Prelude.Maybe Prelude.Text)
auditTaskMetadata_taskId :: Lens' AuditTaskMetadata (Maybe Text)
auditTaskMetadata_taskId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AuditTaskMetadata' {Maybe Text
taskId :: Maybe Text
$sel:taskId:AuditTaskMetadata' :: AuditTaskMetadata -> Maybe Text
taskId} -> Maybe Text
taskId) (\s :: AuditTaskMetadata
s@AuditTaskMetadata' {} Maybe Text
a -> AuditTaskMetadata
s {$sel:taskId:AuditTaskMetadata' :: Maybe Text
taskId = Maybe Text
a} :: AuditTaskMetadata)

-- | The status of this audit. One of \"IN_PROGRESS\", \"COMPLETED\",
-- \"FAILED\", or \"CANCELED\".
auditTaskMetadata_taskStatus :: Lens.Lens' AuditTaskMetadata (Prelude.Maybe AuditTaskStatus)
auditTaskMetadata_taskStatus :: Lens' AuditTaskMetadata (Maybe AuditTaskStatus)
auditTaskMetadata_taskStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AuditTaskMetadata' {Maybe AuditTaskStatus
taskStatus :: Maybe AuditTaskStatus
$sel:taskStatus:AuditTaskMetadata' :: AuditTaskMetadata -> Maybe AuditTaskStatus
taskStatus} -> Maybe AuditTaskStatus
taskStatus) (\s :: AuditTaskMetadata
s@AuditTaskMetadata' {} Maybe AuditTaskStatus
a -> AuditTaskMetadata
s {$sel:taskStatus:AuditTaskMetadata' :: Maybe AuditTaskStatus
taskStatus = Maybe AuditTaskStatus
a} :: AuditTaskMetadata)

-- | The type of this audit. One of \"ON_DEMAND_AUDIT_TASK\" or
-- \"SCHEDULED_AUDIT_TASK\".
auditTaskMetadata_taskType :: Lens.Lens' AuditTaskMetadata (Prelude.Maybe AuditTaskType)
auditTaskMetadata_taskType :: Lens' AuditTaskMetadata (Maybe AuditTaskType)
auditTaskMetadata_taskType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AuditTaskMetadata' {Maybe AuditTaskType
taskType :: Maybe AuditTaskType
$sel:taskType:AuditTaskMetadata' :: AuditTaskMetadata -> Maybe AuditTaskType
taskType} -> Maybe AuditTaskType
taskType) (\s :: AuditTaskMetadata
s@AuditTaskMetadata' {} Maybe AuditTaskType
a -> AuditTaskMetadata
s {$sel:taskType:AuditTaskMetadata' :: Maybe AuditTaskType
taskType = Maybe AuditTaskType
a} :: AuditTaskMetadata)

instance Data.FromJSON AuditTaskMetadata where
  parseJSON :: Value -> Parser AuditTaskMetadata
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AuditTaskMetadata"
      ( \Object
x ->
          Maybe Text
-> Maybe AuditTaskStatus
-> Maybe AuditTaskType
-> AuditTaskMetadata
AuditTaskMetadata'
            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
"taskId")
            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
"taskStatus")
            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
"taskType")
      )

instance Prelude.Hashable AuditTaskMetadata where
  hashWithSalt :: Int -> AuditTaskMetadata -> Int
hashWithSalt Int
_salt AuditTaskMetadata' {Maybe Text
Maybe AuditTaskStatus
Maybe AuditTaskType
taskType :: Maybe AuditTaskType
taskStatus :: Maybe AuditTaskStatus
taskId :: Maybe Text
$sel:taskType:AuditTaskMetadata' :: AuditTaskMetadata -> Maybe AuditTaskType
$sel:taskStatus:AuditTaskMetadata' :: AuditTaskMetadata -> Maybe AuditTaskStatus
$sel:taskId:AuditTaskMetadata' :: AuditTaskMetadata -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
taskId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AuditTaskStatus
taskStatus
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AuditTaskType
taskType

instance Prelude.NFData AuditTaskMetadata where
  rnf :: AuditTaskMetadata -> ()
rnf AuditTaskMetadata' {Maybe Text
Maybe AuditTaskStatus
Maybe AuditTaskType
taskType :: Maybe AuditTaskType
taskStatus :: Maybe AuditTaskStatus
taskId :: Maybe Text
$sel:taskType:AuditTaskMetadata' :: AuditTaskMetadata -> Maybe AuditTaskType
$sel:taskStatus:AuditTaskMetadata' :: AuditTaskMetadata -> Maybe AuditTaskStatus
$sel:taskId:AuditTaskMetadata' :: AuditTaskMetadata -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
taskId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe AuditTaskStatus
taskStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe AuditTaskType
taskType