{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | Details of a device’s status.
--
-- /See:/ 'newDeviceStatusDetail' smart constructor.
data DeviceStatusDetail = DeviceStatusDetail'
  { -- | The device status detail code.
    DeviceStatusDetail -> Maybe DeviceStatusDetailCode
code :: Prelude.Maybe DeviceStatusDetailCode,
    -- | The list of available features on the device.
    DeviceStatusDetail -> Maybe Feature
feature :: Prelude.Maybe Feature
  }
  deriving (DeviceStatusDetail -> DeviceStatusDetail -> Bool
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]
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
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. 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:
--
-- 'code', 'deviceStatusDetail_code' - The device status detail code.
--
-- 'feature', 'deviceStatusDetail_feature' - The list of available features on the device.
newDeviceStatusDetail ::
  DeviceStatusDetail
newDeviceStatusDetail :: DeviceStatusDetail
newDeviceStatusDetail =
  DeviceStatusDetail'
    { $sel:code:DeviceStatusDetail' :: Maybe DeviceStatusDetailCode
code = forall a. Maybe a
Prelude.Nothing,
      $sel:feature:DeviceStatusDetail' :: Maybe Feature
feature = forall a. Maybe a
Prelude.Nothing
    }

-- | The device status detail code.
deviceStatusDetail_code :: Lens.Lens' DeviceStatusDetail (Prelude.Maybe DeviceStatusDetailCode)
deviceStatusDetail_code :: Lens' DeviceStatusDetail (Maybe DeviceStatusDetailCode)
deviceStatusDetail_code = 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)

-- | The list of available features on the device.
deviceStatusDetail_feature :: Lens.Lens' DeviceStatusDetail (Prelude.Maybe Feature)
deviceStatusDetail_feature :: Lens' DeviceStatusDetail (Maybe Feature)
deviceStatusDetail_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)

instance Data.FromJSON DeviceStatusDetail where
  parseJSON :: Value -> Parser DeviceStatusDetail
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"DeviceStatusDetail"
      ( \Object
x ->
          Maybe DeviceStatusDetailCode -> Maybe Feature -> DeviceStatusDetail
DeviceStatusDetail'
            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
"Code")
            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
"Feature")
      )

instance Prelude.Hashable DeviceStatusDetail where
  hashWithSalt :: Int -> DeviceStatusDetail -> Int
hashWithSalt Int
_salt DeviceStatusDetail' {Maybe DeviceStatusDetailCode
Maybe Feature
feature :: Maybe Feature
code :: Maybe DeviceStatusDetailCode
$sel:feature:DeviceStatusDetail' :: DeviceStatusDetail -> Maybe Feature
$sel:code:DeviceStatusDetail' :: DeviceStatusDetail -> Maybe DeviceStatusDetailCode
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe DeviceStatusDetailCode
code
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Feature
feature

instance Prelude.NFData DeviceStatusDetail where
  rnf :: DeviceStatusDetail -> ()
rnf DeviceStatusDetail' {Maybe DeviceStatusDetailCode
Maybe Feature
feature :: Maybe Feature
code :: Maybe DeviceStatusDetailCode
$sel:feature:DeviceStatusDetail' :: DeviceStatusDetail -> Maybe Feature
$sel:code:DeviceStatusDetail' :: DeviceStatusDetail -> Maybe DeviceStatusDetailCode
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe DeviceStatusDetailCode
code seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Feature
feature