{-# 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.MigrationHub.Types.ApplicationState
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.MigrationHub.Types.ApplicationState where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MigrationHub.Types.ApplicationStatus
import qualified Amazonka.Prelude as Prelude

-- | The state of an application discovered through Migration Hub import, the
-- AWS Agentless Discovery Connector, or the AWS Application Discovery
-- Agent.
--
-- /See:/ 'newApplicationState' smart constructor.
data ApplicationState = ApplicationState'
  { -- | The timestamp when the application status was last updated.
    ApplicationState -> Maybe POSIX
lastUpdatedTime :: Prelude.Maybe Core.POSIX,
    -- | The configurationId from the Application Discovery Service that uniquely
    -- identifies an application.
    ApplicationState -> Maybe Text
applicationId :: Prelude.Maybe Prelude.Text,
    -- | The current status of an application.
    ApplicationState -> Maybe ApplicationStatus
applicationStatus :: Prelude.Maybe ApplicationStatus
  }
  deriving (ApplicationState -> ApplicationState -> Bool
(ApplicationState -> ApplicationState -> Bool)
-> (ApplicationState -> ApplicationState -> Bool)
-> Eq ApplicationState
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ApplicationState -> ApplicationState -> Bool
$c/= :: ApplicationState -> ApplicationState -> Bool
== :: ApplicationState -> ApplicationState -> Bool
$c== :: ApplicationState -> ApplicationState -> Bool
Prelude.Eq, ReadPrec [ApplicationState]
ReadPrec ApplicationState
Int -> ReadS ApplicationState
ReadS [ApplicationState]
(Int -> ReadS ApplicationState)
-> ReadS [ApplicationState]
-> ReadPrec ApplicationState
-> ReadPrec [ApplicationState]
-> Read ApplicationState
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ApplicationState]
$creadListPrec :: ReadPrec [ApplicationState]
readPrec :: ReadPrec ApplicationState
$creadPrec :: ReadPrec ApplicationState
readList :: ReadS [ApplicationState]
$creadList :: ReadS [ApplicationState]
readsPrec :: Int -> ReadS ApplicationState
$creadsPrec :: Int -> ReadS ApplicationState
Prelude.Read, Int -> ApplicationState -> ShowS
[ApplicationState] -> ShowS
ApplicationState -> String
(Int -> ApplicationState -> ShowS)
-> (ApplicationState -> String)
-> ([ApplicationState] -> ShowS)
-> Show ApplicationState
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ApplicationState] -> ShowS
$cshowList :: [ApplicationState] -> ShowS
show :: ApplicationState -> String
$cshow :: ApplicationState -> String
showsPrec :: Int -> ApplicationState -> ShowS
$cshowsPrec :: Int -> ApplicationState -> ShowS
Prelude.Show, (forall x. ApplicationState -> Rep ApplicationState x)
-> (forall x. Rep ApplicationState x -> ApplicationState)
-> Generic ApplicationState
forall x. Rep ApplicationState x -> ApplicationState
forall x. ApplicationState -> Rep ApplicationState x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ApplicationState x -> ApplicationState
$cfrom :: forall x. ApplicationState -> Rep ApplicationState x
Prelude.Generic)

-- |
-- Create a value of 'ApplicationState' 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:
--
-- 'lastUpdatedTime', 'applicationState_lastUpdatedTime' - The timestamp when the application status was last updated.
--
-- 'applicationId', 'applicationState_applicationId' - The configurationId from the Application Discovery Service that uniquely
-- identifies an application.
--
-- 'applicationStatus', 'applicationState_applicationStatus' - The current status of an application.
newApplicationState ::
  ApplicationState
newApplicationState :: ApplicationState
newApplicationState =
  ApplicationState' :: Maybe POSIX
-> Maybe Text -> Maybe ApplicationStatus -> ApplicationState
ApplicationState'
    { $sel:lastUpdatedTime:ApplicationState' :: Maybe POSIX
lastUpdatedTime =
        Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:applicationId:ApplicationState' :: Maybe Text
applicationId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:applicationStatus:ApplicationState' :: Maybe ApplicationStatus
applicationStatus = Maybe ApplicationStatus
forall a. Maybe a
Prelude.Nothing
    }

-- | The timestamp when the application status was last updated.
applicationState_lastUpdatedTime :: Lens.Lens' ApplicationState (Prelude.Maybe Prelude.UTCTime)
applicationState_lastUpdatedTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ApplicationState -> f ApplicationState
applicationState_lastUpdatedTime = (ApplicationState -> Maybe POSIX)
-> (ApplicationState -> Maybe POSIX -> ApplicationState)
-> Lens
     ApplicationState ApplicationState (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApplicationState' {Maybe POSIX
lastUpdatedTime :: Maybe POSIX
$sel:lastUpdatedTime:ApplicationState' :: ApplicationState -> Maybe POSIX
lastUpdatedTime} -> Maybe POSIX
lastUpdatedTime) (\s :: ApplicationState
s@ApplicationState' {} Maybe POSIX
a -> ApplicationState
s {$sel:lastUpdatedTime:ApplicationState' :: Maybe POSIX
lastUpdatedTime = Maybe POSIX
a} :: ApplicationState) ((Maybe POSIX -> f (Maybe POSIX))
 -> ApplicationState -> f ApplicationState)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ApplicationState
-> f ApplicationState
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The configurationId from the Application Discovery Service that uniquely
-- identifies an application.
applicationState_applicationId :: Lens.Lens' ApplicationState (Prelude.Maybe Prelude.Text)
applicationState_applicationId :: (Maybe Text -> f (Maybe Text))
-> ApplicationState -> f ApplicationState
applicationState_applicationId = (ApplicationState -> Maybe Text)
-> (ApplicationState -> Maybe Text -> ApplicationState)
-> Lens ApplicationState ApplicationState (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApplicationState' {Maybe Text
applicationId :: Maybe Text
$sel:applicationId:ApplicationState' :: ApplicationState -> Maybe Text
applicationId} -> Maybe Text
applicationId) (\s :: ApplicationState
s@ApplicationState' {} Maybe Text
a -> ApplicationState
s {$sel:applicationId:ApplicationState' :: Maybe Text
applicationId = Maybe Text
a} :: ApplicationState)

-- | The current status of an application.
applicationState_applicationStatus :: Lens.Lens' ApplicationState (Prelude.Maybe ApplicationStatus)
applicationState_applicationStatus :: (Maybe ApplicationStatus -> f (Maybe ApplicationStatus))
-> ApplicationState -> f ApplicationState
applicationState_applicationStatus = (ApplicationState -> Maybe ApplicationStatus)
-> (ApplicationState
    -> Maybe ApplicationStatus -> ApplicationState)
-> Lens
     ApplicationState
     ApplicationState
     (Maybe ApplicationStatus)
     (Maybe ApplicationStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApplicationState' {Maybe ApplicationStatus
applicationStatus :: Maybe ApplicationStatus
$sel:applicationStatus:ApplicationState' :: ApplicationState -> Maybe ApplicationStatus
applicationStatus} -> Maybe ApplicationStatus
applicationStatus) (\s :: ApplicationState
s@ApplicationState' {} Maybe ApplicationStatus
a -> ApplicationState
s {$sel:applicationStatus:ApplicationState' :: Maybe ApplicationStatus
applicationStatus = Maybe ApplicationStatus
a} :: ApplicationState)

instance Core.FromJSON ApplicationState where
  parseJSON :: Value -> Parser ApplicationState
parseJSON =
    String
-> (Object -> Parser ApplicationState)
-> Value
-> Parser ApplicationState
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ApplicationState"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Text -> Maybe ApplicationStatus -> ApplicationState
ApplicationState'
            (Maybe POSIX
 -> Maybe Text -> Maybe ApplicationStatus -> ApplicationState)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text -> Maybe ApplicationStatus -> ApplicationState)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LastUpdatedTime")
            Parser (Maybe Text -> Maybe ApplicationStatus -> ApplicationState)
-> Parser (Maybe Text)
-> Parser (Maybe ApplicationStatus -> ApplicationState)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ApplicationId")
            Parser (Maybe ApplicationStatus -> ApplicationState)
-> Parser (Maybe ApplicationStatus) -> Parser ApplicationState
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ApplicationStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ApplicationStatus")
      )

instance Prelude.Hashable ApplicationState

instance Prelude.NFData ApplicationState