{-# 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.Panorama.Types.LatestDeviceJob
-- 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.Panorama.Types.LatestDeviceJob where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Panorama.Types.JobType
import Amazonka.Panorama.Types.UpdateProgress
import qualified Amazonka.Prelude as Prelude

-- | Returns information about the latest device job.
--
-- /See:/ 'newLatestDeviceJob' smart constructor.
data LatestDeviceJob = LatestDeviceJob'
  { -- | The target version of the device software.
    LatestDeviceJob -> Maybe Text
imageVersion :: Prelude.Maybe Prelude.Text,
    -- | The job\'s type.
    LatestDeviceJob -> Maybe JobType
jobType :: Prelude.Maybe JobType,
    -- | Status of the latest device job.
    LatestDeviceJob -> Maybe UpdateProgress
status :: Prelude.Maybe UpdateProgress
  }
  deriving (LatestDeviceJob -> LatestDeviceJob -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LatestDeviceJob -> LatestDeviceJob -> Bool
$c/= :: LatestDeviceJob -> LatestDeviceJob -> Bool
== :: LatestDeviceJob -> LatestDeviceJob -> Bool
$c== :: LatestDeviceJob -> LatestDeviceJob -> Bool
Prelude.Eq, ReadPrec [LatestDeviceJob]
ReadPrec LatestDeviceJob
Int -> ReadS LatestDeviceJob
ReadS [LatestDeviceJob]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LatestDeviceJob]
$creadListPrec :: ReadPrec [LatestDeviceJob]
readPrec :: ReadPrec LatestDeviceJob
$creadPrec :: ReadPrec LatestDeviceJob
readList :: ReadS [LatestDeviceJob]
$creadList :: ReadS [LatestDeviceJob]
readsPrec :: Int -> ReadS LatestDeviceJob
$creadsPrec :: Int -> ReadS LatestDeviceJob
Prelude.Read, Int -> LatestDeviceJob -> ShowS
[LatestDeviceJob] -> ShowS
LatestDeviceJob -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LatestDeviceJob] -> ShowS
$cshowList :: [LatestDeviceJob] -> ShowS
show :: LatestDeviceJob -> String
$cshow :: LatestDeviceJob -> String
showsPrec :: Int -> LatestDeviceJob -> ShowS
$cshowsPrec :: Int -> LatestDeviceJob -> ShowS
Prelude.Show, forall x. Rep LatestDeviceJob x -> LatestDeviceJob
forall x. LatestDeviceJob -> Rep LatestDeviceJob x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LatestDeviceJob x -> LatestDeviceJob
$cfrom :: forall x. LatestDeviceJob -> Rep LatestDeviceJob x
Prelude.Generic)

-- |
-- Create a value of 'LatestDeviceJob' 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:
--
-- 'imageVersion', 'latestDeviceJob_imageVersion' - The target version of the device software.
--
-- 'jobType', 'latestDeviceJob_jobType' - The job\'s type.
--
-- 'status', 'latestDeviceJob_status' - Status of the latest device job.
newLatestDeviceJob ::
  LatestDeviceJob
newLatestDeviceJob :: LatestDeviceJob
newLatestDeviceJob =
  LatestDeviceJob'
    { $sel:imageVersion:LatestDeviceJob' :: Maybe Text
imageVersion = forall a. Maybe a
Prelude.Nothing,
      $sel:jobType:LatestDeviceJob' :: Maybe JobType
jobType = forall a. Maybe a
Prelude.Nothing,
      $sel:status:LatestDeviceJob' :: Maybe UpdateProgress
status = forall a. Maybe a
Prelude.Nothing
    }

-- | The target version of the device software.
latestDeviceJob_imageVersion :: Lens.Lens' LatestDeviceJob (Prelude.Maybe Prelude.Text)
latestDeviceJob_imageVersion :: Lens' LatestDeviceJob (Maybe Text)
latestDeviceJob_imageVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LatestDeviceJob' {Maybe Text
imageVersion :: Maybe Text
$sel:imageVersion:LatestDeviceJob' :: LatestDeviceJob -> Maybe Text
imageVersion} -> Maybe Text
imageVersion) (\s :: LatestDeviceJob
s@LatestDeviceJob' {} Maybe Text
a -> LatestDeviceJob
s {$sel:imageVersion:LatestDeviceJob' :: Maybe Text
imageVersion = Maybe Text
a} :: LatestDeviceJob)

-- | The job\'s type.
latestDeviceJob_jobType :: Lens.Lens' LatestDeviceJob (Prelude.Maybe JobType)
latestDeviceJob_jobType :: Lens' LatestDeviceJob (Maybe JobType)
latestDeviceJob_jobType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LatestDeviceJob' {Maybe JobType
jobType :: Maybe JobType
$sel:jobType:LatestDeviceJob' :: LatestDeviceJob -> Maybe JobType
jobType} -> Maybe JobType
jobType) (\s :: LatestDeviceJob
s@LatestDeviceJob' {} Maybe JobType
a -> LatestDeviceJob
s {$sel:jobType:LatestDeviceJob' :: Maybe JobType
jobType = Maybe JobType
a} :: LatestDeviceJob)

-- | Status of the latest device job.
latestDeviceJob_status :: Lens.Lens' LatestDeviceJob (Prelude.Maybe UpdateProgress)
latestDeviceJob_status :: Lens' LatestDeviceJob (Maybe UpdateProgress)
latestDeviceJob_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LatestDeviceJob' {Maybe UpdateProgress
status :: Maybe UpdateProgress
$sel:status:LatestDeviceJob' :: LatestDeviceJob -> Maybe UpdateProgress
status} -> Maybe UpdateProgress
status) (\s :: LatestDeviceJob
s@LatestDeviceJob' {} Maybe UpdateProgress
a -> LatestDeviceJob
s {$sel:status:LatestDeviceJob' :: Maybe UpdateProgress
status = Maybe UpdateProgress
a} :: LatestDeviceJob)

instance Data.FromJSON LatestDeviceJob where
  parseJSON :: Value -> Parser LatestDeviceJob
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"LatestDeviceJob"
      ( \Object
x ->
          Maybe Text
-> Maybe JobType -> Maybe UpdateProgress -> LatestDeviceJob
LatestDeviceJob'
            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
"ImageVersion")
            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
"JobType")
            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
"Status")
      )

instance Prelude.Hashable LatestDeviceJob where
  hashWithSalt :: Int -> LatestDeviceJob -> Int
hashWithSalt Int
_salt LatestDeviceJob' {Maybe Text
Maybe JobType
Maybe UpdateProgress
status :: Maybe UpdateProgress
jobType :: Maybe JobType
imageVersion :: Maybe Text
$sel:status:LatestDeviceJob' :: LatestDeviceJob -> Maybe UpdateProgress
$sel:jobType:LatestDeviceJob' :: LatestDeviceJob -> Maybe JobType
$sel:imageVersion:LatestDeviceJob' :: LatestDeviceJob -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
imageVersion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe JobType
jobType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe UpdateProgress
status

instance Prelude.NFData LatestDeviceJob where
  rnf :: LatestDeviceJob -> ()
rnf LatestDeviceJob' {Maybe Text
Maybe JobType
Maybe UpdateProgress
status :: Maybe UpdateProgress
jobType :: Maybe JobType
imageVersion :: Maybe Text
$sel:status:LatestDeviceJob' :: LatestDeviceJob -> Maybe UpdateProgress
$sel:jobType:LatestDeviceJob' :: LatestDeviceJob -> Maybe JobType
$sel:imageVersion:LatestDeviceJob' :: LatestDeviceJob -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
imageVersion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe JobType
jobType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe UpdateProgress
status