{-# 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.IoTSiteWise.Types.GatewaySummary
-- 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.IoTSiteWise.Types.GatewaySummary where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoTSiteWise.Types.GatewayCapabilitySummary
import Amazonka.IoTSiteWise.Types.GatewayPlatform
import qualified Amazonka.Prelude as Prelude

-- | Contains a summary of a gateway.
--
-- /See:/ 'newGatewaySummary' smart constructor.
data GatewaySummary = GatewaySummary'
  { -- | A list of gateway capability summaries that each contain a namespace and
    -- status. Each gateway capability defines data sources for the gateway. To
    -- retrieve a capability configuration\'s definition, use
    -- <https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_DescribeGatewayCapabilityConfiguration.html DescribeGatewayCapabilityConfiguration>.
    GatewaySummary -> Maybe [GatewayCapabilitySummary]
gatewayCapabilitySummaries :: Prelude.Maybe [GatewayCapabilitySummary],
    GatewaySummary -> Maybe GatewayPlatform
gatewayPlatform :: Prelude.Maybe GatewayPlatform,
    -- | The ID of the gateway device.
    GatewaySummary -> Text
gatewayId :: Prelude.Text,
    -- | The name of the asset.
    GatewaySummary -> Text
gatewayName :: Prelude.Text,
    -- | The date the gateway was created, in Unix epoch time.
    GatewaySummary -> POSIX
creationDate :: Data.POSIX,
    -- | The date the gateway was last updated, in Unix epoch time.
    GatewaySummary -> POSIX
lastUpdateDate :: Data.POSIX
  }
  deriving (GatewaySummary -> GatewaySummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GatewaySummary -> GatewaySummary -> Bool
$c/= :: GatewaySummary -> GatewaySummary -> Bool
== :: GatewaySummary -> GatewaySummary -> Bool
$c== :: GatewaySummary -> GatewaySummary -> Bool
Prelude.Eq, ReadPrec [GatewaySummary]
ReadPrec GatewaySummary
Int -> ReadS GatewaySummary
ReadS [GatewaySummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GatewaySummary]
$creadListPrec :: ReadPrec [GatewaySummary]
readPrec :: ReadPrec GatewaySummary
$creadPrec :: ReadPrec GatewaySummary
readList :: ReadS [GatewaySummary]
$creadList :: ReadS [GatewaySummary]
readsPrec :: Int -> ReadS GatewaySummary
$creadsPrec :: Int -> ReadS GatewaySummary
Prelude.Read, Int -> GatewaySummary -> ShowS
[GatewaySummary] -> ShowS
GatewaySummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GatewaySummary] -> ShowS
$cshowList :: [GatewaySummary] -> ShowS
show :: GatewaySummary -> String
$cshow :: GatewaySummary -> String
showsPrec :: Int -> GatewaySummary -> ShowS
$cshowsPrec :: Int -> GatewaySummary -> ShowS
Prelude.Show, forall x. Rep GatewaySummary x -> GatewaySummary
forall x. GatewaySummary -> Rep GatewaySummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GatewaySummary x -> GatewaySummary
$cfrom :: forall x. GatewaySummary -> Rep GatewaySummary x
Prelude.Generic)

-- |
-- Create a value of 'GatewaySummary' 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:
--
-- 'gatewayCapabilitySummaries', 'gatewaySummary_gatewayCapabilitySummaries' - A list of gateway capability summaries that each contain a namespace and
-- status. Each gateway capability defines data sources for the gateway. To
-- retrieve a capability configuration\'s definition, use
-- <https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_DescribeGatewayCapabilityConfiguration.html DescribeGatewayCapabilityConfiguration>.
--
-- 'gatewayPlatform', 'gatewaySummary_gatewayPlatform' - Undocumented member.
--
-- 'gatewayId', 'gatewaySummary_gatewayId' - The ID of the gateway device.
--
-- 'gatewayName', 'gatewaySummary_gatewayName' - The name of the asset.
--
-- 'creationDate', 'gatewaySummary_creationDate' - The date the gateway was created, in Unix epoch time.
--
-- 'lastUpdateDate', 'gatewaySummary_lastUpdateDate' - The date the gateway was last updated, in Unix epoch time.
newGatewaySummary ::
  -- | 'gatewayId'
  Prelude.Text ->
  -- | 'gatewayName'
  Prelude.Text ->
  -- | 'creationDate'
  Prelude.UTCTime ->
  -- | 'lastUpdateDate'
  Prelude.UTCTime ->
  GatewaySummary
newGatewaySummary :: Text -> Text -> UTCTime -> UTCTime -> GatewaySummary
newGatewaySummary
  Text
pGatewayId_
  Text
pGatewayName_
  UTCTime
pCreationDate_
  UTCTime
pLastUpdateDate_ =
    GatewaySummary'
      { $sel:gatewayCapabilitySummaries:GatewaySummary' :: Maybe [GatewayCapabilitySummary]
gatewayCapabilitySummaries =
          forall a. Maybe a
Prelude.Nothing,
        $sel:gatewayPlatform:GatewaySummary' :: Maybe GatewayPlatform
gatewayPlatform = forall a. Maybe a
Prelude.Nothing,
        $sel:gatewayId:GatewaySummary' :: Text
gatewayId = Text
pGatewayId_,
        $sel:gatewayName:GatewaySummary' :: Text
gatewayName = Text
pGatewayName_,
        $sel:creationDate:GatewaySummary' :: POSIX
creationDate = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pCreationDate_,
        $sel:lastUpdateDate:GatewaySummary' :: POSIX
lastUpdateDate = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pLastUpdateDate_
      }

-- | A list of gateway capability summaries that each contain a namespace and
-- status. Each gateway capability defines data sources for the gateway. To
-- retrieve a capability configuration\'s definition, use
-- <https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_DescribeGatewayCapabilityConfiguration.html DescribeGatewayCapabilityConfiguration>.
gatewaySummary_gatewayCapabilitySummaries :: Lens.Lens' GatewaySummary (Prelude.Maybe [GatewayCapabilitySummary])
gatewaySummary_gatewayCapabilitySummaries :: Lens' GatewaySummary (Maybe [GatewayCapabilitySummary])
gatewaySummary_gatewayCapabilitySummaries = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GatewaySummary' {Maybe [GatewayCapabilitySummary]
gatewayCapabilitySummaries :: Maybe [GatewayCapabilitySummary]
$sel:gatewayCapabilitySummaries:GatewaySummary' :: GatewaySummary -> Maybe [GatewayCapabilitySummary]
gatewayCapabilitySummaries} -> Maybe [GatewayCapabilitySummary]
gatewayCapabilitySummaries) (\s :: GatewaySummary
s@GatewaySummary' {} Maybe [GatewayCapabilitySummary]
a -> GatewaySummary
s {$sel:gatewayCapabilitySummaries:GatewaySummary' :: Maybe [GatewayCapabilitySummary]
gatewayCapabilitySummaries = Maybe [GatewayCapabilitySummary]
a} :: GatewaySummary) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Undocumented member.
gatewaySummary_gatewayPlatform :: Lens.Lens' GatewaySummary (Prelude.Maybe GatewayPlatform)
gatewaySummary_gatewayPlatform :: Lens' GatewaySummary (Maybe GatewayPlatform)
gatewaySummary_gatewayPlatform = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GatewaySummary' {Maybe GatewayPlatform
gatewayPlatform :: Maybe GatewayPlatform
$sel:gatewayPlatform:GatewaySummary' :: GatewaySummary -> Maybe GatewayPlatform
gatewayPlatform} -> Maybe GatewayPlatform
gatewayPlatform) (\s :: GatewaySummary
s@GatewaySummary' {} Maybe GatewayPlatform
a -> GatewaySummary
s {$sel:gatewayPlatform:GatewaySummary' :: Maybe GatewayPlatform
gatewayPlatform = Maybe GatewayPlatform
a} :: GatewaySummary)

-- | The ID of the gateway device.
gatewaySummary_gatewayId :: Lens.Lens' GatewaySummary Prelude.Text
gatewaySummary_gatewayId :: Lens' GatewaySummary Text
gatewaySummary_gatewayId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GatewaySummary' {Text
gatewayId :: Text
$sel:gatewayId:GatewaySummary' :: GatewaySummary -> Text
gatewayId} -> Text
gatewayId) (\s :: GatewaySummary
s@GatewaySummary' {} Text
a -> GatewaySummary
s {$sel:gatewayId:GatewaySummary' :: Text
gatewayId = Text
a} :: GatewaySummary)

-- | The name of the asset.
gatewaySummary_gatewayName :: Lens.Lens' GatewaySummary Prelude.Text
gatewaySummary_gatewayName :: Lens' GatewaySummary Text
gatewaySummary_gatewayName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GatewaySummary' {Text
gatewayName :: Text
$sel:gatewayName:GatewaySummary' :: GatewaySummary -> Text
gatewayName} -> Text
gatewayName) (\s :: GatewaySummary
s@GatewaySummary' {} Text
a -> GatewaySummary
s {$sel:gatewayName:GatewaySummary' :: Text
gatewayName = Text
a} :: GatewaySummary)

-- | The date the gateway was created, in Unix epoch time.
gatewaySummary_creationDate :: Lens.Lens' GatewaySummary Prelude.UTCTime
gatewaySummary_creationDate :: Lens' GatewaySummary UTCTime
gatewaySummary_creationDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GatewaySummary' {POSIX
creationDate :: POSIX
$sel:creationDate:GatewaySummary' :: GatewaySummary -> POSIX
creationDate} -> POSIX
creationDate) (\s :: GatewaySummary
s@GatewaySummary' {} POSIX
a -> GatewaySummary
s {$sel:creationDate:GatewaySummary' :: POSIX
creationDate = POSIX
a} :: GatewaySummary) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The date the gateway was last updated, in Unix epoch time.
gatewaySummary_lastUpdateDate :: Lens.Lens' GatewaySummary Prelude.UTCTime
gatewaySummary_lastUpdateDate :: Lens' GatewaySummary UTCTime
gatewaySummary_lastUpdateDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GatewaySummary' {POSIX
lastUpdateDate :: POSIX
$sel:lastUpdateDate:GatewaySummary' :: GatewaySummary -> POSIX
lastUpdateDate} -> POSIX
lastUpdateDate) (\s :: GatewaySummary
s@GatewaySummary' {} POSIX
a -> GatewaySummary
s {$sel:lastUpdateDate:GatewaySummary' :: POSIX
lastUpdateDate = POSIX
a} :: GatewaySummary) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

instance Data.FromJSON GatewaySummary where
  parseJSON :: Value -> Parser GatewaySummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"GatewaySummary"
      ( \Object
x ->
          Maybe [GatewayCapabilitySummary]
-> Maybe GatewayPlatform
-> Text
-> Text
-> POSIX
-> POSIX
-> GatewaySummary
GatewaySummary'
            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
"gatewayCapabilitySummaries"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            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
"gatewayPlatform")
            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
"gatewayId")
            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
"gatewayName")
            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
"creationDate")
            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
"lastUpdateDate")
      )

instance Prelude.Hashable GatewaySummary where
  hashWithSalt :: Int -> GatewaySummary -> Int
hashWithSalt Int
_salt GatewaySummary' {Maybe [GatewayCapabilitySummary]
Maybe GatewayPlatform
Text
POSIX
lastUpdateDate :: POSIX
creationDate :: POSIX
gatewayName :: Text
gatewayId :: Text
gatewayPlatform :: Maybe GatewayPlatform
gatewayCapabilitySummaries :: Maybe [GatewayCapabilitySummary]
$sel:lastUpdateDate:GatewaySummary' :: GatewaySummary -> POSIX
$sel:creationDate:GatewaySummary' :: GatewaySummary -> POSIX
$sel:gatewayName:GatewaySummary' :: GatewaySummary -> Text
$sel:gatewayId:GatewaySummary' :: GatewaySummary -> Text
$sel:gatewayPlatform:GatewaySummary' :: GatewaySummary -> Maybe GatewayPlatform
$sel:gatewayCapabilitySummaries:GatewaySummary' :: GatewaySummary -> Maybe [GatewayCapabilitySummary]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [GatewayCapabilitySummary]
gatewayCapabilitySummaries
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe GatewayPlatform
gatewayPlatform
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
gatewayId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
gatewayName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
creationDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
lastUpdateDate

instance Prelude.NFData GatewaySummary where
  rnf :: GatewaySummary -> ()
rnf GatewaySummary' {Maybe [GatewayCapabilitySummary]
Maybe GatewayPlatform
Text
POSIX
lastUpdateDate :: POSIX
creationDate :: POSIX
gatewayName :: Text
gatewayId :: Text
gatewayPlatform :: Maybe GatewayPlatform
gatewayCapabilitySummaries :: Maybe [GatewayCapabilitySummary]
$sel:lastUpdateDate:GatewaySummary' :: GatewaySummary -> POSIX
$sel:creationDate:GatewaySummary' :: GatewaySummary -> POSIX
$sel:gatewayName:GatewaySummary' :: GatewaySummary -> Text
$sel:gatewayId:GatewaySummary' :: GatewaySummary -> Text
$sel:gatewayPlatform:GatewaySummary' :: GatewaySummary -> Maybe GatewayPlatform
$sel:gatewayCapabilitySummaries:GatewaySummary' :: GatewaySummary -> Maybe [GatewayCapabilitySummary]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [GatewayCapabilitySummary]
gatewayCapabilitySummaries
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe GatewayPlatform
gatewayPlatform
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
gatewayId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
gatewayName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
creationDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
lastUpdateDate