{-# 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.OTAUpdateSummary
-- 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.OTAUpdateSummary where

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

-- | An OTA update summary.
--
-- /See:/ 'newOTAUpdateSummary' smart constructor.
data OTAUpdateSummary = OTAUpdateSummary'
  { -- | The date when the OTA update was created.
    OTAUpdateSummary -> Maybe POSIX
creationDate :: Prelude.Maybe Data.POSIX,
    -- | The OTA update ARN.
    OTAUpdateSummary -> Maybe Text
otaUpdateArn :: Prelude.Maybe Prelude.Text,
    -- | The OTA update ID.
    OTAUpdateSummary -> Maybe Text
otaUpdateId :: Prelude.Maybe Prelude.Text
  }
  deriving (OTAUpdateSummary -> OTAUpdateSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OTAUpdateSummary -> OTAUpdateSummary -> Bool
$c/= :: OTAUpdateSummary -> OTAUpdateSummary -> Bool
== :: OTAUpdateSummary -> OTAUpdateSummary -> Bool
$c== :: OTAUpdateSummary -> OTAUpdateSummary -> Bool
Prelude.Eq, ReadPrec [OTAUpdateSummary]
ReadPrec OTAUpdateSummary
Int -> ReadS OTAUpdateSummary
ReadS [OTAUpdateSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OTAUpdateSummary]
$creadListPrec :: ReadPrec [OTAUpdateSummary]
readPrec :: ReadPrec OTAUpdateSummary
$creadPrec :: ReadPrec OTAUpdateSummary
readList :: ReadS [OTAUpdateSummary]
$creadList :: ReadS [OTAUpdateSummary]
readsPrec :: Int -> ReadS OTAUpdateSummary
$creadsPrec :: Int -> ReadS OTAUpdateSummary
Prelude.Read, Int -> OTAUpdateSummary -> ShowS
[OTAUpdateSummary] -> ShowS
OTAUpdateSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OTAUpdateSummary] -> ShowS
$cshowList :: [OTAUpdateSummary] -> ShowS
show :: OTAUpdateSummary -> String
$cshow :: OTAUpdateSummary -> String
showsPrec :: Int -> OTAUpdateSummary -> ShowS
$cshowsPrec :: Int -> OTAUpdateSummary -> ShowS
Prelude.Show, forall x. Rep OTAUpdateSummary x -> OTAUpdateSummary
forall x. OTAUpdateSummary -> Rep OTAUpdateSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OTAUpdateSummary x -> OTAUpdateSummary
$cfrom :: forall x. OTAUpdateSummary -> Rep OTAUpdateSummary x
Prelude.Generic)

-- |
-- Create a value of 'OTAUpdateSummary' 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:
--
-- 'creationDate', 'oTAUpdateSummary_creationDate' - The date when the OTA update was created.
--
-- 'otaUpdateArn', 'oTAUpdateSummary_otaUpdateArn' - The OTA update ARN.
--
-- 'otaUpdateId', 'oTAUpdateSummary_otaUpdateId' - The OTA update ID.
newOTAUpdateSummary ::
  OTAUpdateSummary
newOTAUpdateSummary :: OTAUpdateSummary
newOTAUpdateSummary =
  OTAUpdateSummary'
    { $sel:creationDate:OTAUpdateSummary' :: Maybe POSIX
creationDate = forall a. Maybe a
Prelude.Nothing,
      $sel:otaUpdateArn:OTAUpdateSummary' :: Maybe Text
otaUpdateArn = forall a. Maybe a
Prelude.Nothing,
      $sel:otaUpdateId:OTAUpdateSummary' :: Maybe Text
otaUpdateId = forall a. Maybe a
Prelude.Nothing
    }

-- | The date when the OTA update was created.
oTAUpdateSummary_creationDate :: Lens.Lens' OTAUpdateSummary (Prelude.Maybe Prelude.UTCTime)
oTAUpdateSummary_creationDate :: Lens' OTAUpdateSummary (Maybe UTCTime)
oTAUpdateSummary_creationDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OTAUpdateSummary' {Maybe POSIX
creationDate :: Maybe POSIX
$sel:creationDate:OTAUpdateSummary' :: OTAUpdateSummary -> Maybe POSIX
creationDate} -> Maybe POSIX
creationDate) (\s :: OTAUpdateSummary
s@OTAUpdateSummary' {} Maybe POSIX
a -> OTAUpdateSummary
s {$sel:creationDate:OTAUpdateSummary' :: Maybe POSIX
creationDate = Maybe POSIX
a} :: OTAUpdateSummary) 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 OTA update ARN.
oTAUpdateSummary_otaUpdateArn :: Lens.Lens' OTAUpdateSummary (Prelude.Maybe Prelude.Text)
oTAUpdateSummary_otaUpdateArn :: Lens' OTAUpdateSummary (Maybe Text)
oTAUpdateSummary_otaUpdateArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OTAUpdateSummary' {Maybe Text
otaUpdateArn :: Maybe Text
$sel:otaUpdateArn:OTAUpdateSummary' :: OTAUpdateSummary -> Maybe Text
otaUpdateArn} -> Maybe Text
otaUpdateArn) (\s :: OTAUpdateSummary
s@OTAUpdateSummary' {} Maybe Text
a -> OTAUpdateSummary
s {$sel:otaUpdateArn:OTAUpdateSummary' :: Maybe Text
otaUpdateArn = Maybe Text
a} :: OTAUpdateSummary)

-- | The OTA update ID.
oTAUpdateSummary_otaUpdateId :: Lens.Lens' OTAUpdateSummary (Prelude.Maybe Prelude.Text)
oTAUpdateSummary_otaUpdateId :: Lens' OTAUpdateSummary (Maybe Text)
oTAUpdateSummary_otaUpdateId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OTAUpdateSummary' {Maybe Text
otaUpdateId :: Maybe Text
$sel:otaUpdateId:OTAUpdateSummary' :: OTAUpdateSummary -> Maybe Text
otaUpdateId} -> Maybe Text
otaUpdateId) (\s :: OTAUpdateSummary
s@OTAUpdateSummary' {} Maybe Text
a -> OTAUpdateSummary
s {$sel:otaUpdateId:OTAUpdateSummary' :: Maybe Text
otaUpdateId = Maybe Text
a} :: OTAUpdateSummary)

instance Data.FromJSON OTAUpdateSummary where
  parseJSON :: Value -> Parser OTAUpdateSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"OTAUpdateSummary"
      ( \Object
x ->
          Maybe POSIX -> Maybe Text -> Maybe Text -> OTAUpdateSummary
OTAUpdateSummary'
            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
"creationDate")
            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
"otaUpdateArn")
            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
"otaUpdateId")
      )

instance Prelude.Hashable OTAUpdateSummary where
  hashWithSalt :: Int -> OTAUpdateSummary -> Int
hashWithSalt Int
_salt OTAUpdateSummary' {Maybe Text
Maybe POSIX
otaUpdateId :: Maybe Text
otaUpdateArn :: Maybe Text
creationDate :: Maybe POSIX
$sel:otaUpdateId:OTAUpdateSummary' :: OTAUpdateSummary -> Maybe Text
$sel:otaUpdateArn:OTAUpdateSummary' :: OTAUpdateSummary -> Maybe Text
$sel:creationDate:OTAUpdateSummary' :: OTAUpdateSummary -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
creationDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
otaUpdateArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
otaUpdateId

instance Prelude.NFData OTAUpdateSummary where
  rnf :: OTAUpdateSummary -> ()
rnf OTAUpdateSummary' {Maybe Text
Maybe POSIX
otaUpdateId :: Maybe Text
otaUpdateArn :: Maybe Text
creationDate :: Maybe POSIX
$sel:otaUpdateId:OTAUpdateSummary' :: OTAUpdateSummary -> Maybe Text
$sel:otaUpdateArn:OTAUpdateSummary' :: OTAUpdateSummary -> Maybe Text
$sel:creationDate:OTAUpdateSummary' :: OTAUpdateSummary -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
creationDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
otaUpdateArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
otaUpdateId