{-# 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.IoTFleetHub.Types.ApplicationSummary
-- 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.IoTFleetHub.Types.ApplicationSummary where

import qualified Amazonka.Core as Core
import Amazonka.IoTFleetHub.Types.ApplicationState
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A summary of information about a AWS IoT Device Management web
-- application.
--
-- Fleet Hub for AWS IoT Device Management is in public preview and is
-- subject to change.
--
-- /See:/ 'newApplicationSummary' smart constructor.
data ApplicationSummary = ApplicationSummary'
  { -- | An optional description of the web application.
    ApplicationSummary -> Maybe Text
applicationDescription :: Prelude.Maybe Prelude.Text,
    -- | The current state of the web application.
    ApplicationSummary -> Maybe ApplicationState
applicationState :: Prelude.Maybe ApplicationState,
    -- | The date (in Unix epoch time) when the web application was created.
    ApplicationSummary -> Maybe Integer
applicationCreationDate :: Prelude.Maybe Prelude.Integer,
    -- | The date (in Unix epoch time) when the web application was last updated.
    ApplicationSummary -> Maybe Integer
applicationLastUpdateDate :: Prelude.Maybe Prelude.Integer,
    -- | The unique Id of the web application.
    ApplicationSummary -> Text
applicationId :: Prelude.Text,
    -- | The name of the web application.
    ApplicationSummary -> Text
applicationName :: Prelude.Text,
    -- | The URL of the web application.
    ApplicationSummary -> Text
applicationUrl :: Prelude.Text
  }
  deriving (ApplicationSummary -> ApplicationSummary -> Bool
(ApplicationSummary -> ApplicationSummary -> Bool)
-> (ApplicationSummary -> ApplicationSummary -> Bool)
-> Eq ApplicationSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ApplicationSummary -> ApplicationSummary -> Bool
$c/= :: ApplicationSummary -> ApplicationSummary -> Bool
== :: ApplicationSummary -> ApplicationSummary -> Bool
$c== :: ApplicationSummary -> ApplicationSummary -> Bool
Prelude.Eq, ReadPrec [ApplicationSummary]
ReadPrec ApplicationSummary
Int -> ReadS ApplicationSummary
ReadS [ApplicationSummary]
(Int -> ReadS ApplicationSummary)
-> ReadS [ApplicationSummary]
-> ReadPrec ApplicationSummary
-> ReadPrec [ApplicationSummary]
-> Read ApplicationSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ApplicationSummary]
$creadListPrec :: ReadPrec [ApplicationSummary]
readPrec :: ReadPrec ApplicationSummary
$creadPrec :: ReadPrec ApplicationSummary
readList :: ReadS [ApplicationSummary]
$creadList :: ReadS [ApplicationSummary]
readsPrec :: Int -> ReadS ApplicationSummary
$creadsPrec :: Int -> ReadS ApplicationSummary
Prelude.Read, Int -> ApplicationSummary -> ShowS
[ApplicationSummary] -> ShowS
ApplicationSummary -> String
(Int -> ApplicationSummary -> ShowS)
-> (ApplicationSummary -> String)
-> ([ApplicationSummary] -> ShowS)
-> Show ApplicationSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ApplicationSummary] -> ShowS
$cshowList :: [ApplicationSummary] -> ShowS
show :: ApplicationSummary -> String
$cshow :: ApplicationSummary -> String
showsPrec :: Int -> ApplicationSummary -> ShowS
$cshowsPrec :: Int -> ApplicationSummary -> ShowS
Prelude.Show, (forall x. ApplicationSummary -> Rep ApplicationSummary x)
-> (forall x. Rep ApplicationSummary x -> ApplicationSummary)
-> Generic ApplicationSummary
forall x. Rep ApplicationSummary x -> ApplicationSummary
forall x. ApplicationSummary -> Rep ApplicationSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ApplicationSummary x -> ApplicationSummary
$cfrom :: forall x. ApplicationSummary -> Rep ApplicationSummary x
Prelude.Generic)

-- |
-- Create a value of 'ApplicationSummary' 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:
--
-- 'applicationDescription', 'applicationSummary_applicationDescription' - An optional description of the web application.
--
-- 'applicationState', 'applicationSummary_applicationState' - The current state of the web application.
--
-- 'applicationCreationDate', 'applicationSummary_applicationCreationDate' - The date (in Unix epoch time) when the web application was created.
--
-- 'applicationLastUpdateDate', 'applicationSummary_applicationLastUpdateDate' - The date (in Unix epoch time) when the web application was last updated.
--
-- 'applicationId', 'applicationSummary_applicationId' - The unique Id of the web application.
--
-- 'applicationName', 'applicationSummary_applicationName' - The name of the web application.
--
-- 'applicationUrl', 'applicationSummary_applicationUrl' - The URL of the web application.
newApplicationSummary ::
  -- | 'applicationId'
  Prelude.Text ->
  -- | 'applicationName'
  Prelude.Text ->
  -- | 'applicationUrl'
  Prelude.Text ->
  ApplicationSummary
newApplicationSummary :: Text -> Text -> Text -> ApplicationSummary
newApplicationSummary
  Text
pApplicationId_
  Text
pApplicationName_
  Text
pApplicationUrl_ =
    ApplicationSummary' :: Maybe Text
-> Maybe ApplicationState
-> Maybe Integer
-> Maybe Integer
-> Text
-> Text
-> Text
-> ApplicationSummary
ApplicationSummary'
      { $sel:applicationDescription:ApplicationSummary' :: Maybe Text
applicationDescription =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:applicationState:ApplicationSummary' :: Maybe ApplicationState
applicationState = Maybe ApplicationState
forall a. Maybe a
Prelude.Nothing,
        $sel:applicationCreationDate:ApplicationSummary' :: Maybe Integer
applicationCreationDate = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
        $sel:applicationLastUpdateDate:ApplicationSummary' :: Maybe Integer
applicationLastUpdateDate = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
        $sel:applicationId:ApplicationSummary' :: Text
applicationId = Text
pApplicationId_,
        $sel:applicationName:ApplicationSummary' :: Text
applicationName = Text
pApplicationName_,
        $sel:applicationUrl:ApplicationSummary' :: Text
applicationUrl = Text
pApplicationUrl_
      }

-- | An optional description of the web application.
applicationSummary_applicationDescription :: Lens.Lens' ApplicationSummary (Prelude.Maybe Prelude.Text)
applicationSummary_applicationDescription :: (Maybe Text -> f (Maybe Text))
-> ApplicationSummary -> f ApplicationSummary
applicationSummary_applicationDescription = (ApplicationSummary -> Maybe Text)
-> (ApplicationSummary -> Maybe Text -> ApplicationSummary)
-> Lens
     ApplicationSummary ApplicationSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApplicationSummary' {Maybe Text
applicationDescription :: Maybe Text
$sel:applicationDescription:ApplicationSummary' :: ApplicationSummary -> Maybe Text
applicationDescription} -> Maybe Text
applicationDescription) (\s :: ApplicationSummary
s@ApplicationSummary' {} Maybe Text
a -> ApplicationSummary
s {$sel:applicationDescription:ApplicationSummary' :: Maybe Text
applicationDescription = Maybe Text
a} :: ApplicationSummary)

-- | The current state of the web application.
applicationSummary_applicationState :: Lens.Lens' ApplicationSummary (Prelude.Maybe ApplicationState)
applicationSummary_applicationState :: (Maybe ApplicationState -> f (Maybe ApplicationState))
-> ApplicationSummary -> f ApplicationSummary
applicationSummary_applicationState = (ApplicationSummary -> Maybe ApplicationState)
-> (ApplicationSummary
    -> Maybe ApplicationState -> ApplicationSummary)
-> Lens
     ApplicationSummary
     ApplicationSummary
     (Maybe ApplicationState)
     (Maybe ApplicationState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApplicationSummary' {Maybe ApplicationState
applicationState :: Maybe ApplicationState
$sel:applicationState:ApplicationSummary' :: ApplicationSummary -> Maybe ApplicationState
applicationState} -> Maybe ApplicationState
applicationState) (\s :: ApplicationSummary
s@ApplicationSummary' {} Maybe ApplicationState
a -> ApplicationSummary
s {$sel:applicationState:ApplicationSummary' :: Maybe ApplicationState
applicationState = Maybe ApplicationState
a} :: ApplicationSummary)

-- | The date (in Unix epoch time) when the web application was created.
applicationSummary_applicationCreationDate :: Lens.Lens' ApplicationSummary (Prelude.Maybe Prelude.Integer)
applicationSummary_applicationCreationDate :: (Maybe Integer -> f (Maybe Integer))
-> ApplicationSummary -> f ApplicationSummary
applicationSummary_applicationCreationDate = (ApplicationSummary -> Maybe Integer)
-> (ApplicationSummary -> Maybe Integer -> ApplicationSummary)
-> Lens
     ApplicationSummary
     ApplicationSummary
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApplicationSummary' {Maybe Integer
applicationCreationDate :: Maybe Integer
$sel:applicationCreationDate:ApplicationSummary' :: ApplicationSummary -> Maybe Integer
applicationCreationDate} -> Maybe Integer
applicationCreationDate) (\s :: ApplicationSummary
s@ApplicationSummary' {} Maybe Integer
a -> ApplicationSummary
s {$sel:applicationCreationDate:ApplicationSummary' :: Maybe Integer
applicationCreationDate = Maybe Integer
a} :: ApplicationSummary)

-- | The date (in Unix epoch time) when the web application was last updated.
applicationSummary_applicationLastUpdateDate :: Lens.Lens' ApplicationSummary (Prelude.Maybe Prelude.Integer)
applicationSummary_applicationLastUpdateDate :: (Maybe Integer -> f (Maybe Integer))
-> ApplicationSummary -> f ApplicationSummary
applicationSummary_applicationLastUpdateDate = (ApplicationSummary -> Maybe Integer)
-> (ApplicationSummary -> Maybe Integer -> ApplicationSummary)
-> Lens
     ApplicationSummary
     ApplicationSummary
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApplicationSummary' {Maybe Integer
applicationLastUpdateDate :: Maybe Integer
$sel:applicationLastUpdateDate:ApplicationSummary' :: ApplicationSummary -> Maybe Integer
applicationLastUpdateDate} -> Maybe Integer
applicationLastUpdateDate) (\s :: ApplicationSummary
s@ApplicationSummary' {} Maybe Integer
a -> ApplicationSummary
s {$sel:applicationLastUpdateDate:ApplicationSummary' :: Maybe Integer
applicationLastUpdateDate = Maybe Integer
a} :: ApplicationSummary)

-- | The unique Id of the web application.
applicationSummary_applicationId :: Lens.Lens' ApplicationSummary Prelude.Text
applicationSummary_applicationId :: (Text -> f Text) -> ApplicationSummary -> f ApplicationSummary
applicationSummary_applicationId = (ApplicationSummary -> Text)
-> (ApplicationSummary -> Text -> ApplicationSummary)
-> Lens ApplicationSummary ApplicationSummary Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApplicationSummary' {Text
applicationId :: Text
$sel:applicationId:ApplicationSummary' :: ApplicationSummary -> Text
applicationId} -> Text
applicationId) (\s :: ApplicationSummary
s@ApplicationSummary' {} Text
a -> ApplicationSummary
s {$sel:applicationId:ApplicationSummary' :: Text
applicationId = Text
a} :: ApplicationSummary)

-- | The name of the web application.
applicationSummary_applicationName :: Lens.Lens' ApplicationSummary Prelude.Text
applicationSummary_applicationName :: (Text -> f Text) -> ApplicationSummary -> f ApplicationSummary
applicationSummary_applicationName = (ApplicationSummary -> Text)
-> (ApplicationSummary -> Text -> ApplicationSummary)
-> Lens ApplicationSummary ApplicationSummary Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApplicationSummary' {Text
applicationName :: Text
$sel:applicationName:ApplicationSummary' :: ApplicationSummary -> Text
applicationName} -> Text
applicationName) (\s :: ApplicationSummary
s@ApplicationSummary' {} Text
a -> ApplicationSummary
s {$sel:applicationName:ApplicationSummary' :: Text
applicationName = Text
a} :: ApplicationSummary)

-- | The URL of the web application.
applicationSummary_applicationUrl :: Lens.Lens' ApplicationSummary Prelude.Text
applicationSummary_applicationUrl :: (Text -> f Text) -> ApplicationSummary -> f ApplicationSummary
applicationSummary_applicationUrl = (ApplicationSummary -> Text)
-> (ApplicationSummary -> Text -> ApplicationSummary)
-> Lens ApplicationSummary ApplicationSummary Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApplicationSummary' {Text
applicationUrl :: Text
$sel:applicationUrl:ApplicationSummary' :: ApplicationSummary -> Text
applicationUrl} -> Text
applicationUrl) (\s :: ApplicationSummary
s@ApplicationSummary' {} Text
a -> ApplicationSummary
s {$sel:applicationUrl:ApplicationSummary' :: Text
applicationUrl = Text
a} :: ApplicationSummary)

instance Core.FromJSON ApplicationSummary where
  parseJSON :: Value -> Parser ApplicationSummary
parseJSON =
    String
-> (Object -> Parser ApplicationSummary)
-> Value
-> Parser ApplicationSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ApplicationSummary"
      ( \Object
x ->
          Maybe Text
-> Maybe ApplicationState
-> Maybe Integer
-> Maybe Integer
-> Text
-> Text
-> Text
-> ApplicationSummary
ApplicationSummary'
            (Maybe Text
 -> Maybe ApplicationState
 -> Maybe Integer
 -> Maybe Integer
 -> Text
 -> Text
 -> Text
 -> ApplicationSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe ApplicationState
      -> Maybe Integer
      -> Maybe Integer
      -> Text
      -> Text
      -> Text
      -> ApplicationSummary)
forall (f :: * -> *) a b. Functor 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
"applicationDescription")
            Parser
  (Maybe ApplicationState
   -> Maybe Integer
   -> Maybe Integer
   -> Text
   -> Text
   -> Text
   -> ApplicationSummary)
-> Parser (Maybe ApplicationState)
-> Parser
     (Maybe Integer
      -> Maybe Integer -> Text -> Text -> Text -> ApplicationSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ApplicationState)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"applicationState")
            Parser
  (Maybe Integer
   -> Maybe Integer -> Text -> Text -> Text -> ApplicationSummary)
-> Parser (Maybe Integer)
-> Parser
     (Maybe Integer -> Text -> Text -> Text -> ApplicationSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"applicationCreationDate")
            Parser
  (Maybe Integer -> Text -> Text -> Text -> ApplicationSummary)
-> Parser (Maybe Integer)
-> Parser (Text -> Text -> Text -> ApplicationSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"applicationLastUpdateDate")
            Parser (Text -> Text -> Text -> ApplicationSummary)
-> Parser Text -> Parser (Text -> Text -> ApplicationSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"applicationId")
            Parser (Text -> Text -> ApplicationSummary)
-> Parser Text -> Parser (Text -> ApplicationSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"applicationName")
            Parser (Text -> ApplicationSummary)
-> Parser Text -> Parser ApplicationSummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"applicationUrl")
      )

instance Prelude.Hashable ApplicationSummary

instance Prelude.NFData ApplicationSummary