{-# 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.ReportedRuntimeContextState
-- 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.ReportedRuntimeContextState 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.DesiredState
import Amazonka.Panorama.Types.DeviceReportedStatus
import qualified Amazonka.Prelude as Prelude

-- | An application instance\'s state.
--
-- /See:/ 'newReportedRuntimeContextState' smart constructor.
data ReportedRuntimeContextState = ReportedRuntimeContextState'
  { -- | The application\'s desired state.
    ReportedRuntimeContextState -> DesiredState
desiredState :: DesiredState,
    -- | The application\'s reported status.
    ReportedRuntimeContextState -> DeviceReportedStatus
deviceReportedStatus :: DeviceReportedStatus,
    -- | When the device reported the application\'s state.
    ReportedRuntimeContextState -> POSIX
deviceReportedTime :: Data.POSIX,
    -- | The device\'s name.
    ReportedRuntimeContextState -> Text
runtimeContextName :: Prelude.Text
  }
  deriving (ReportedRuntimeContextState -> ReportedRuntimeContextState -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ReportedRuntimeContextState -> ReportedRuntimeContextState -> Bool
$c/= :: ReportedRuntimeContextState -> ReportedRuntimeContextState -> Bool
== :: ReportedRuntimeContextState -> ReportedRuntimeContextState -> Bool
$c== :: ReportedRuntimeContextState -> ReportedRuntimeContextState -> Bool
Prelude.Eq, ReadPrec [ReportedRuntimeContextState]
ReadPrec ReportedRuntimeContextState
Int -> ReadS ReportedRuntimeContextState
ReadS [ReportedRuntimeContextState]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ReportedRuntimeContextState]
$creadListPrec :: ReadPrec [ReportedRuntimeContextState]
readPrec :: ReadPrec ReportedRuntimeContextState
$creadPrec :: ReadPrec ReportedRuntimeContextState
readList :: ReadS [ReportedRuntimeContextState]
$creadList :: ReadS [ReportedRuntimeContextState]
readsPrec :: Int -> ReadS ReportedRuntimeContextState
$creadsPrec :: Int -> ReadS ReportedRuntimeContextState
Prelude.Read, Int -> ReportedRuntimeContextState -> ShowS
[ReportedRuntimeContextState] -> ShowS
ReportedRuntimeContextState -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ReportedRuntimeContextState] -> ShowS
$cshowList :: [ReportedRuntimeContextState] -> ShowS
show :: ReportedRuntimeContextState -> String
$cshow :: ReportedRuntimeContextState -> String
showsPrec :: Int -> ReportedRuntimeContextState -> ShowS
$cshowsPrec :: Int -> ReportedRuntimeContextState -> ShowS
Prelude.Show, forall x.
Rep ReportedRuntimeContextState x -> ReportedRuntimeContextState
forall x.
ReportedRuntimeContextState -> Rep ReportedRuntimeContextState x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ReportedRuntimeContextState x -> ReportedRuntimeContextState
$cfrom :: forall x.
ReportedRuntimeContextState -> Rep ReportedRuntimeContextState x
Prelude.Generic)

-- |
-- Create a value of 'ReportedRuntimeContextState' 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:
--
-- 'desiredState', 'reportedRuntimeContextState_desiredState' - The application\'s desired state.
--
-- 'deviceReportedStatus', 'reportedRuntimeContextState_deviceReportedStatus' - The application\'s reported status.
--
-- 'deviceReportedTime', 'reportedRuntimeContextState_deviceReportedTime' - When the device reported the application\'s state.
--
-- 'runtimeContextName', 'reportedRuntimeContextState_runtimeContextName' - The device\'s name.
newReportedRuntimeContextState ::
  -- | 'desiredState'
  DesiredState ->
  -- | 'deviceReportedStatus'
  DeviceReportedStatus ->
  -- | 'deviceReportedTime'
  Prelude.UTCTime ->
  -- | 'runtimeContextName'
  Prelude.Text ->
  ReportedRuntimeContextState
newReportedRuntimeContextState :: DesiredState
-> DeviceReportedStatus
-> UTCTime
-> Text
-> ReportedRuntimeContextState
newReportedRuntimeContextState
  DesiredState
pDesiredState_
  DeviceReportedStatus
pDeviceReportedStatus_
  UTCTime
pDeviceReportedTime_
  Text
pRuntimeContextName_ =
    ReportedRuntimeContextState'
      { $sel:desiredState:ReportedRuntimeContextState' :: DesiredState
desiredState =
          DesiredState
pDesiredState_,
        $sel:deviceReportedStatus:ReportedRuntimeContextState' :: DeviceReportedStatus
deviceReportedStatus = DeviceReportedStatus
pDeviceReportedStatus_,
        $sel:deviceReportedTime:ReportedRuntimeContextState' :: POSIX
deviceReportedTime =
          forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pDeviceReportedTime_,
        $sel:runtimeContextName:ReportedRuntimeContextState' :: Text
runtimeContextName = Text
pRuntimeContextName_
      }

-- | The application\'s desired state.
reportedRuntimeContextState_desiredState :: Lens.Lens' ReportedRuntimeContextState DesiredState
reportedRuntimeContextState_desiredState :: Lens' ReportedRuntimeContextState DesiredState
reportedRuntimeContextState_desiredState = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReportedRuntimeContextState' {DesiredState
desiredState :: DesiredState
$sel:desiredState:ReportedRuntimeContextState' :: ReportedRuntimeContextState -> DesiredState
desiredState} -> DesiredState
desiredState) (\s :: ReportedRuntimeContextState
s@ReportedRuntimeContextState' {} DesiredState
a -> ReportedRuntimeContextState
s {$sel:desiredState:ReportedRuntimeContextState' :: DesiredState
desiredState = DesiredState
a} :: ReportedRuntimeContextState)

-- | The application\'s reported status.
reportedRuntimeContextState_deviceReportedStatus :: Lens.Lens' ReportedRuntimeContextState DeviceReportedStatus
reportedRuntimeContextState_deviceReportedStatus :: Lens' ReportedRuntimeContextState DeviceReportedStatus
reportedRuntimeContextState_deviceReportedStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReportedRuntimeContextState' {DeviceReportedStatus
deviceReportedStatus :: DeviceReportedStatus
$sel:deviceReportedStatus:ReportedRuntimeContextState' :: ReportedRuntimeContextState -> DeviceReportedStatus
deviceReportedStatus} -> DeviceReportedStatus
deviceReportedStatus) (\s :: ReportedRuntimeContextState
s@ReportedRuntimeContextState' {} DeviceReportedStatus
a -> ReportedRuntimeContextState
s {$sel:deviceReportedStatus:ReportedRuntimeContextState' :: DeviceReportedStatus
deviceReportedStatus = DeviceReportedStatus
a} :: ReportedRuntimeContextState)

-- | When the device reported the application\'s state.
reportedRuntimeContextState_deviceReportedTime :: Lens.Lens' ReportedRuntimeContextState Prelude.UTCTime
reportedRuntimeContextState_deviceReportedTime :: Lens' ReportedRuntimeContextState UTCTime
reportedRuntimeContextState_deviceReportedTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReportedRuntimeContextState' {POSIX
deviceReportedTime :: POSIX
$sel:deviceReportedTime:ReportedRuntimeContextState' :: ReportedRuntimeContextState -> POSIX
deviceReportedTime} -> POSIX
deviceReportedTime) (\s :: ReportedRuntimeContextState
s@ReportedRuntimeContextState' {} POSIX
a -> ReportedRuntimeContextState
s {$sel:deviceReportedTime:ReportedRuntimeContextState' :: POSIX
deviceReportedTime = POSIX
a} :: ReportedRuntimeContextState) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The device\'s name.
reportedRuntimeContextState_runtimeContextName :: Lens.Lens' ReportedRuntimeContextState Prelude.Text
reportedRuntimeContextState_runtimeContextName :: Lens' ReportedRuntimeContextState Text
reportedRuntimeContextState_runtimeContextName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReportedRuntimeContextState' {Text
runtimeContextName :: Text
$sel:runtimeContextName:ReportedRuntimeContextState' :: ReportedRuntimeContextState -> Text
runtimeContextName} -> Text
runtimeContextName) (\s :: ReportedRuntimeContextState
s@ReportedRuntimeContextState' {} Text
a -> ReportedRuntimeContextState
s {$sel:runtimeContextName:ReportedRuntimeContextState' :: Text
runtimeContextName = Text
a} :: ReportedRuntimeContextState)

instance Data.FromJSON ReportedRuntimeContextState where
  parseJSON :: Value -> Parser ReportedRuntimeContextState
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ReportedRuntimeContextState"
      ( \Object
x ->
          DesiredState
-> DeviceReportedStatus
-> POSIX
-> Text
-> ReportedRuntimeContextState
ReportedRuntimeContextState'
            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
"DesiredState")
            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
"DeviceReportedStatus")
            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
"DeviceReportedTime")
            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
"RuntimeContextName")
      )

instance Prelude.Hashable ReportedRuntimeContextState where
  hashWithSalt :: Int -> ReportedRuntimeContextState -> Int
hashWithSalt Int
_salt ReportedRuntimeContextState' {Text
POSIX
DesiredState
DeviceReportedStatus
runtimeContextName :: Text
deviceReportedTime :: POSIX
deviceReportedStatus :: DeviceReportedStatus
desiredState :: DesiredState
$sel:runtimeContextName:ReportedRuntimeContextState' :: ReportedRuntimeContextState -> Text
$sel:deviceReportedTime:ReportedRuntimeContextState' :: ReportedRuntimeContextState -> POSIX
$sel:deviceReportedStatus:ReportedRuntimeContextState' :: ReportedRuntimeContextState -> DeviceReportedStatus
$sel:desiredState:ReportedRuntimeContextState' :: ReportedRuntimeContextState -> DesiredState
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` DesiredState
desiredState
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` DeviceReportedStatus
deviceReportedStatus
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
deviceReportedTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
runtimeContextName

instance Prelude.NFData ReportedRuntimeContextState where
  rnf :: ReportedRuntimeContextState -> ()
rnf ReportedRuntimeContextState' {Text
POSIX
DesiredState
DeviceReportedStatus
runtimeContextName :: Text
deviceReportedTime :: POSIX
deviceReportedStatus :: DeviceReportedStatus
desiredState :: DesiredState
$sel:runtimeContextName:ReportedRuntimeContextState' :: ReportedRuntimeContextState -> Text
$sel:deviceReportedTime:ReportedRuntimeContextState' :: ReportedRuntimeContextState -> POSIX
$sel:deviceReportedStatus:ReportedRuntimeContextState' :: ReportedRuntimeContextState -> DeviceReportedStatus
$sel:desiredState:ReportedRuntimeContextState' :: ReportedRuntimeContextState -> DesiredState
..} =
    forall a. NFData a => a -> ()
Prelude.rnf DesiredState
desiredState
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf DeviceReportedStatus
deviceReportedStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
deviceReportedTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
runtimeContextName