{-# 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.AlexaBusiness.Types.DeviceStatusDetail
-- 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.AlexaBusiness.Types.DeviceStatusDetail where

import Amazonka.AlexaBusiness.Types.DeviceStatusDetailCode
import Amazonka.AlexaBusiness.Types.Feature
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Details of a device’s status.
--
-- /See:/ 'newDeviceStatusDetail' smart constructor.
data DeviceStatusDetail = DeviceStatusDetail'
  { -- | The list of available features on the device.
    DeviceStatusDetail -> Maybe Feature
feature :: Prelude.Maybe Feature,
    -- | The device status detail code.
    DeviceStatusDetail -> Maybe DeviceStatusDetailCode
code :: Prelude.Maybe DeviceStatusDetailCode
  }
  deriving (DeviceStatusDetail -> DeviceStatusDetail -> Bool
(DeviceStatusDetail -> DeviceStatusDetail -> Bool)
-> (DeviceStatusDetail -> DeviceStatusDetail -> Bool)
-> Eq DeviceStatusDetail
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeviceStatusDetail -> DeviceStatusDetail -> Bool
$c/= :: DeviceStatusDetail -> DeviceStatusDetail -> Bool
== :: DeviceStatusDetail -> DeviceStatusDetail -> Bool
$c== :: DeviceStatusDetail -> DeviceStatusDetail -> Bool
Prelude.Eq, ReadPrec [DeviceStatusDetail]
ReadPrec DeviceStatusDetail
Int -> ReadS DeviceStatusDetail
ReadS [DeviceStatusDetail]
(Int -> ReadS DeviceStatusDetail)
-> ReadS [DeviceStatusDetail]
-> ReadPrec DeviceStatusDetail
-> ReadPrec [DeviceStatusDetail]
-> Read DeviceStatusDetail
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeviceStatusDetail]
$creadListPrec :: ReadPrec [DeviceStatusDetail]
readPrec :: ReadPrec DeviceStatusDetail
$creadPrec :: ReadPrec DeviceStatusDetail
readList :: ReadS [DeviceStatusDetail]
$creadList :: ReadS [DeviceStatusDetail]
readsPrec :: Int -> ReadS DeviceStatusDetail
$creadsPrec :: Int -> ReadS DeviceStatusDetail
Prelude.Read, Int -> DeviceStatusDetail -> ShowS
[DeviceStatusDetail] -> ShowS
DeviceStatusDetail -> String
(Int -> DeviceStatusDetail -> ShowS)
-> (DeviceStatusDetail -> String)
-> ([DeviceStatusDetail] -> ShowS)
-> Show DeviceStatusDetail
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeviceStatusDetail] -> ShowS
$cshowList :: [DeviceStatusDetail] -> ShowS
show :: DeviceStatusDetail -> String
$cshow :: DeviceStatusDetail -> String
showsPrec :: Int -> DeviceStatusDetail -> ShowS
$cshowsPrec :: Int -> DeviceStatusDetail -> ShowS
Prelude.Show, (forall x. DeviceStatusDetail -> Rep DeviceStatusDetail x)
-> (forall x. Rep DeviceStatusDetail x -> DeviceStatusDetail)
-> Generic DeviceStatusDetail
forall x. Rep DeviceStatusDetail x -> DeviceStatusDetail
forall x. DeviceStatusDetail -> Rep DeviceStatusDetail x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeviceStatusDetail x -> DeviceStatusDetail
$cfrom :: forall x. DeviceStatusDetail -> Rep DeviceStatusDetail x
Prelude.Generic)

-- |
-- Create a value of 'DeviceStatusDetail' 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:
--
-- 'feature', 'deviceStatusDetail_feature' - The list of available features on the device.
--
-- 'code', 'deviceStatusDetail_code' - The device status detail code.
newDeviceStatusDetail ::
  DeviceStatusDetail
newDeviceStatusDetail :: DeviceStatusDetail
newDeviceStatusDetail =
  DeviceStatusDetail' :: Maybe Feature -> Maybe DeviceStatusDetailCode -> DeviceStatusDetail
DeviceStatusDetail'
    { $sel:feature:DeviceStatusDetail' :: Maybe Feature
feature = Maybe Feature
forall a. Maybe a
Prelude.Nothing,
      $sel:code:DeviceStatusDetail' :: Maybe DeviceStatusDetailCode
code = Maybe DeviceStatusDetailCode
forall a. Maybe a
Prelude.Nothing
    }

-- | The list of available features on the device.
deviceStatusDetail_feature :: Lens.Lens' DeviceStatusDetail (Prelude.Maybe Feature)
deviceStatusDetail_feature :: (Maybe Feature -> f (Maybe Feature))
-> DeviceStatusDetail -> f DeviceStatusDetail
deviceStatusDetail_feature = (DeviceStatusDetail -> Maybe Feature)
-> (DeviceStatusDetail -> Maybe Feature -> DeviceStatusDetail)
-> Lens
     DeviceStatusDetail
     DeviceStatusDetail
     (Maybe Feature)
     (Maybe Feature)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceStatusDetail' {Maybe Feature
feature :: Maybe Feature
$sel:feature:DeviceStatusDetail' :: DeviceStatusDetail -> Maybe Feature
feature} -> Maybe Feature
feature) (\s :: DeviceStatusDetail
s@DeviceStatusDetail' {} Maybe Feature
a -> DeviceStatusDetail
s {$sel:feature:DeviceStatusDetail' :: Maybe Feature
feature = Maybe Feature
a} :: DeviceStatusDetail)

-- | The device status detail code.
deviceStatusDetail_code :: Lens.Lens' DeviceStatusDetail (Prelude.Maybe DeviceStatusDetailCode)
deviceStatusDetail_code :: (Maybe DeviceStatusDetailCode -> f (Maybe DeviceStatusDetailCode))
-> DeviceStatusDetail -> f DeviceStatusDetail
deviceStatusDetail_code = (DeviceStatusDetail -> Maybe DeviceStatusDetailCode)
-> (DeviceStatusDetail
    -> Maybe DeviceStatusDetailCode -> DeviceStatusDetail)
-> Lens
     DeviceStatusDetail
     DeviceStatusDetail
     (Maybe DeviceStatusDetailCode)
     (Maybe DeviceStatusDetailCode)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceStatusDetail' {Maybe DeviceStatusDetailCode
code :: Maybe DeviceStatusDetailCode
$sel:code:DeviceStatusDetail' :: DeviceStatusDetail -> Maybe DeviceStatusDetailCode
code} -> Maybe DeviceStatusDetailCode
code) (\s :: DeviceStatusDetail
s@DeviceStatusDetail' {} Maybe DeviceStatusDetailCode
a -> DeviceStatusDetail
s {$sel:code:DeviceStatusDetail' :: Maybe DeviceStatusDetailCode
code = Maybe DeviceStatusDetailCode
a} :: DeviceStatusDetail)

instance Core.FromJSON DeviceStatusDetail where
  parseJSON :: Value -> Parser DeviceStatusDetail
parseJSON =
    String
-> (Object -> Parser DeviceStatusDetail)
-> Value
-> Parser DeviceStatusDetail
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DeviceStatusDetail"
      ( \Object
x ->
          Maybe Feature -> Maybe DeviceStatusDetailCode -> DeviceStatusDetail
DeviceStatusDetail'
            (Maybe Feature
 -> Maybe DeviceStatusDetailCode -> DeviceStatusDetail)
-> Parser (Maybe Feature)
-> Parser (Maybe DeviceStatusDetailCode -> DeviceStatusDetail)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Feature)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Feature")
            Parser (Maybe DeviceStatusDetailCode -> DeviceStatusDetail)
-> Parser (Maybe DeviceStatusDetailCode)
-> Parser DeviceStatusDetail
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe DeviceStatusDetailCode)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Code")
      )

instance Prelude.Hashable DeviceStatusDetail

instance Prelude.NFData DeviceStatusDetail