{-# 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.Snowball.Types.WirelessConnection
-- 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.Snowball.Types.WirelessConnection where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Configures the wireless connection on an AWS Snowcone device.
--
-- /See:/ 'newWirelessConnection' smart constructor.
data WirelessConnection = WirelessConnection'
  { -- | Enables the Wi-Fi adapter on an AWS Snowcone device.
    WirelessConnection -> Maybe Bool
isWifiEnabled :: Prelude.Maybe Prelude.Bool
  }
  deriving (WirelessConnection -> WirelessConnection -> Bool
(WirelessConnection -> WirelessConnection -> Bool)
-> (WirelessConnection -> WirelessConnection -> Bool)
-> Eq WirelessConnection
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WirelessConnection -> WirelessConnection -> Bool
$c/= :: WirelessConnection -> WirelessConnection -> Bool
== :: WirelessConnection -> WirelessConnection -> Bool
$c== :: WirelessConnection -> WirelessConnection -> Bool
Prelude.Eq, ReadPrec [WirelessConnection]
ReadPrec WirelessConnection
Int -> ReadS WirelessConnection
ReadS [WirelessConnection]
(Int -> ReadS WirelessConnection)
-> ReadS [WirelessConnection]
-> ReadPrec WirelessConnection
-> ReadPrec [WirelessConnection]
-> Read WirelessConnection
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WirelessConnection]
$creadListPrec :: ReadPrec [WirelessConnection]
readPrec :: ReadPrec WirelessConnection
$creadPrec :: ReadPrec WirelessConnection
readList :: ReadS [WirelessConnection]
$creadList :: ReadS [WirelessConnection]
readsPrec :: Int -> ReadS WirelessConnection
$creadsPrec :: Int -> ReadS WirelessConnection
Prelude.Read, Int -> WirelessConnection -> ShowS
[WirelessConnection] -> ShowS
WirelessConnection -> String
(Int -> WirelessConnection -> ShowS)
-> (WirelessConnection -> String)
-> ([WirelessConnection] -> ShowS)
-> Show WirelessConnection
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WirelessConnection] -> ShowS
$cshowList :: [WirelessConnection] -> ShowS
show :: WirelessConnection -> String
$cshow :: WirelessConnection -> String
showsPrec :: Int -> WirelessConnection -> ShowS
$cshowsPrec :: Int -> WirelessConnection -> ShowS
Prelude.Show, (forall x. WirelessConnection -> Rep WirelessConnection x)
-> (forall x. Rep WirelessConnection x -> WirelessConnection)
-> Generic WirelessConnection
forall x. Rep WirelessConnection x -> WirelessConnection
forall x. WirelessConnection -> Rep WirelessConnection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep WirelessConnection x -> WirelessConnection
$cfrom :: forall x. WirelessConnection -> Rep WirelessConnection x
Prelude.Generic)

-- |
-- Create a value of 'WirelessConnection' 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:
--
-- 'isWifiEnabled', 'wirelessConnection_isWifiEnabled' - Enables the Wi-Fi adapter on an AWS Snowcone device.
newWirelessConnection ::
  WirelessConnection
newWirelessConnection :: WirelessConnection
newWirelessConnection =
  WirelessConnection' :: Maybe Bool -> WirelessConnection
WirelessConnection'
    { $sel:isWifiEnabled:WirelessConnection' :: Maybe Bool
isWifiEnabled =
        Maybe Bool
forall a. Maybe a
Prelude.Nothing
    }

-- | Enables the Wi-Fi adapter on an AWS Snowcone device.
wirelessConnection_isWifiEnabled :: Lens.Lens' WirelessConnection (Prelude.Maybe Prelude.Bool)
wirelessConnection_isWifiEnabled :: (Maybe Bool -> f (Maybe Bool))
-> WirelessConnection -> f WirelessConnection
wirelessConnection_isWifiEnabled = (WirelessConnection -> Maybe Bool)
-> (WirelessConnection -> Maybe Bool -> WirelessConnection)
-> Lens
     WirelessConnection WirelessConnection (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WirelessConnection' {Maybe Bool
isWifiEnabled :: Maybe Bool
$sel:isWifiEnabled:WirelessConnection' :: WirelessConnection -> Maybe Bool
isWifiEnabled} -> Maybe Bool
isWifiEnabled) (\s :: WirelessConnection
s@WirelessConnection' {} Maybe Bool
a -> WirelessConnection
s {$sel:isWifiEnabled:WirelessConnection' :: Maybe Bool
isWifiEnabled = Maybe Bool
a} :: WirelessConnection)

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

instance Prelude.Hashable WirelessConnection

instance Prelude.NFData WirelessConnection

instance Core.ToJSON WirelessConnection where
  toJSON :: WirelessConnection -> Value
toJSON WirelessConnection' {Maybe Bool
isWifiEnabled :: Maybe Bool
$sel:isWifiEnabled:WirelessConnection' :: WirelessConnection -> Maybe Bool
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"IsWifiEnabled" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
isWifiEnabled
          ]
      )