{-# 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.WorkLink.Types.DeviceSummary
-- 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.WorkLink.Types.DeviceSummary where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.WorkLink.Types.DeviceStatus

-- | The summary of devices.
--
-- /See:/ 'newDeviceSummary' smart constructor.
data DeviceSummary = DeviceSummary'
  { -- | The status of the device.
    DeviceSummary -> Maybe DeviceStatus
deviceStatus :: Prelude.Maybe DeviceStatus,
    -- | The ID of the device.
    DeviceSummary -> Maybe Text
deviceId :: Prelude.Maybe Prelude.Text
  }
  deriving (DeviceSummary -> DeviceSummary -> Bool
(DeviceSummary -> DeviceSummary -> Bool)
-> (DeviceSummary -> DeviceSummary -> Bool) -> Eq DeviceSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeviceSummary -> DeviceSummary -> Bool
$c/= :: DeviceSummary -> DeviceSummary -> Bool
== :: DeviceSummary -> DeviceSummary -> Bool
$c== :: DeviceSummary -> DeviceSummary -> Bool
Prelude.Eq, ReadPrec [DeviceSummary]
ReadPrec DeviceSummary
Int -> ReadS DeviceSummary
ReadS [DeviceSummary]
(Int -> ReadS DeviceSummary)
-> ReadS [DeviceSummary]
-> ReadPrec DeviceSummary
-> ReadPrec [DeviceSummary]
-> Read DeviceSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeviceSummary]
$creadListPrec :: ReadPrec [DeviceSummary]
readPrec :: ReadPrec DeviceSummary
$creadPrec :: ReadPrec DeviceSummary
readList :: ReadS [DeviceSummary]
$creadList :: ReadS [DeviceSummary]
readsPrec :: Int -> ReadS DeviceSummary
$creadsPrec :: Int -> ReadS DeviceSummary
Prelude.Read, Int -> DeviceSummary -> ShowS
[DeviceSummary] -> ShowS
DeviceSummary -> String
(Int -> DeviceSummary -> ShowS)
-> (DeviceSummary -> String)
-> ([DeviceSummary] -> ShowS)
-> Show DeviceSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeviceSummary] -> ShowS
$cshowList :: [DeviceSummary] -> ShowS
show :: DeviceSummary -> String
$cshow :: DeviceSummary -> String
showsPrec :: Int -> DeviceSummary -> ShowS
$cshowsPrec :: Int -> DeviceSummary -> ShowS
Prelude.Show, (forall x. DeviceSummary -> Rep DeviceSummary x)
-> (forall x. Rep DeviceSummary x -> DeviceSummary)
-> Generic DeviceSummary
forall x. Rep DeviceSummary x -> DeviceSummary
forall x. DeviceSummary -> Rep DeviceSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeviceSummary x -> DeviceSummary
$cfrom :: forall x. DeviceSummary -> Rep DeviceSummary x
Prelude.Generic)

-- |
-- Create a value of 'DeviceSummary' 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:
--
-- 'deviceStatus', 'deviceSummary_deviceStatus' - The status of the device.
--
-- 'deviceId', 'deviceSummary_deviceId' - The ID of the device.
newDeviceSummary ::
  DeviceSummary
newDeviceSummary :: DeviceSummary
newDeviceSummary =
  DeviceSummary' :: Maybe DeviceStatus -> Maybe Text -> DeviceSummary
DeviceSummary'
    { $sel:deviceStatus:DeviceSummary' :: Maybe DeviceStatus
deviceStatus = Maybe DeviceStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:deviceId:DeviceSummary' :: Maybe Text
deviceId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The status of the device.
deviceSummary_deviceStatus :: Lens.Lens' DeviceSummary (Prelude.Maybe DeviceStatus)
deviceSummary_deviceStatus :: (Maybe DeviceStatus -> f (Maybe DeviceStatus))
-> DeviceSummary -> f DeviceSummary
deviceSummary_deviceStatus = (DeviceSummary -> Maybe DeviceStatus)
-> (DeviceSummary -> Maybe DeviceStatus -> DeviceSummary)
-> Lens
     DeviceSummary
     DeviceSummary
     (Maybe DeviceStatus)
     (Maybe DeviceStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceSummary' {Maybe DeviceStatus
deviceStatus :: Maybe DeviceStatus
$sel:deviceStatus:DeviceSummary' :: DeviceSummary -> Maybe DeviceStatus
deviceStatus} -> Maybe DeviceStatus
deviceStatus) (\s :: DeviceSummary
s@DeviceSummary' {} Maybe DeviceStatus
a -> DeviceSummary
s {$sel:deviceStatus:DeviceSummary' :: Maybe DeviceStatus
deviceStatus = Maybe DeviceStatus
a} :: DeviceSummary)

-- | The ID of the device.
deviceSummary_deviceId :: Lens.Lens' DeviceSummary (Prelude.Maybe Prelude.Text)
deviceSummary_deviceId :: (Maybe Text -> f (Maybe Text)) -> DeviceSummary -> f DeviceSummary
deviceSummary_deviceId = (DeviceSummary -> Maybe Text)
-> (DeviceSummary -> Maybe Text -> DeviceSummary)
-> Lens DeviceSummary DeviceSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceSummary' {Maybe Text
deviceId :: Maybe Text
$sel:deviceId:DeviceSummary' :: DeviceSummary -> Maybe Text
deviceId} -> Maybe Text
deviceId) (\s :: DeviceSummary
s@DeviceSummary' {} Maybe Text
a -> DeviceSummary
s {$sel:deviceId:DeviceSummary' :: Maybe Text
deviceId = Maybe Text
a} :: DeviceSummary)

instance Core.FromJSON DeviceSummary where
  parseJSON :: Value -> Parser DeviceSummary
parseJSON =
    String
-> (Object -> Parser DeviceSummary)
-> Value
-> Parser DeviceSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DeviceSummary"
      ( \Object
x ->
          Maybe DeviceStatus -> Maybe Text -> DeviceSummary
DeviceSummary'
            (Maybe DeviceStatus -> Maybe Text -> DeviceSummary)
-> Parser (Maybe DeviceStatus)
-> Parser (Maybe Text -> DeviceSummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe DeviceStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DeviceStatus")
            Parser (Maybe Text -> DeviceSummary)
-> Parser (Maybe Text) -> Parser DeviceSummary
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
"DeviceId")
      )

instance Prelude.Hashable DeviceSummary

instance Prelude.NFData DeviceSummary