{-# 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.DeviceFarm.Types.Radios
-- 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.DeviceFarm.Types.Radios where

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

-- | Represents the set of radios and their states on a device. Examples of
-- radios include Wi-Fi, GPS, Bluetooth, and NFC.
--
-- /See:/ 'newRadios' smart constructor.
data Radios = Radios'
  { -- | True if Bluetooth is enabled at the beginning of the test. Otherwise,
    -- false.
    Radios -> Maybe Bool
bluetooth :: Prelude.Maybe Prelude.Bool,
    -- | True if GPS is enabled at the beginning of the test. Otherwise, false.
    Radios -> Maybe Bool
gps :: Prelude.Maybe Prelude.Bool,
    -- | True if NFC is enabled at the beginning of the test. Otherwise, false.
    Radios -> Maybe Bool
nfc :: Prelude.Maybe Prelude.Bool,
    -- | True if Wi-Fi is enabled at the beginning of the test. Otherwise, false.
    Radios -> Maybe Bool
wifi :: Prelude.Maybe Prelude.Bool
  }
  deriving (Radios -> Radios -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Radios -> Radios -> Bool
$c/= :: Radios -> Radios -> Bool
== :: Radios -> Radios -> Bool
$c== :: Radios -> Radios -> Bool
Prelude.Eq, ReadPrec [Radios]
ReadPrec Radios
Int -> ReadS Radios
ReadS [Radios]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Radios]
$creadListPrec :: ReadPrec [Radios]
readPrec :: ReadPrec Radios
$creadPrec :: ReadPrec Radios
readList :: ReadS [Radios]
$creadList :: ReadS [Radios]
readsPrec :: Int -> ReadS Radios
$creadsPrec :: Int -> ReadS Radios
Prelude.Read, Int -> Radios -> ShowS
[Radios] -> ShowS
Radios -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Radios] -> ShowS
$cshowList :: [Radios] -> ShowS
show :: Radios -> String
$cshow :: Radios -> String
showsPrec :: Int -> Radios -> ShowS
$cshowsPrec :: Int -> Radios -> ShowS
Prelude.Show, forall x. Rep Radios x -> Radios
forall x. Radios -> Rep Radios x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Radios x -> Radios
$cfrom :: forall x. Radios -> Rep Radios x
Prelude.Generic)

-- |
-- Create a value of 'Radios' 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:
--
-- 'bluetooth', 'radios_bluetooth' - True if Bluetooth is enabled at the beginning of the test. Otherwise,
-- false.
--
-- 'gps', 'radios_gps' - True if GPS is enabled at the beginning of the test. Otherwise, false.
--
-- 'nfc', 'radios_nfc' - True if NFC is enabled at the beginning of the test. Otherwise, false.
--
-- 'wifi', 'radios_wifi' - True if Wi-Fi is enabled at the beginning of the test. Otherwise, false.
newRadios ::
  Radios
newRadios :: Radios
newRadios =
  Radios'
    { $sel:bluetooth:Radios' :: Maybe Bool
bluetooth = forall a. Maybe a
Prelude.Nothing,
      $sel:gps:Radios' :: Maybe Bool
gps = forall a. Maybe a
Prelude.Nothing,
      $sel:nfc:Radios' :: Maybe Bool
nfc = forall a. Maybe a
Prelude.Nothing,
      $sel:wifi:Radios' :: Maybe Bool
wifi = forall a. Maybe a
Prelude.Nothing
    }

-- | True if Bluetooth is enabled at the beginning of the test. Otherwise,
-- false.
radios_bluetooth :: Lens.Lens' Radios (Prelude.Maybe Prelude.Bool)
radios_bluetooth :: Lens' Radios (Maybe Bool)
radios_bluetooth = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Radios' {Maybe Bool
bluetooth :: Maybe Bool
$sel:bluetooth:Radios' :: Radios -> Maybe Bool
bluetooth} -> Maybe Bool
bluetooth) (\s :: Radios
s@Radios' {} Maybe Bool
a -> Radios
s {$sel:bluetooth:Radios' :: Maybe Bool
bluetooth = Maybe Bool
a} :: Radios)

-- | True if GPS is enabled at the beginning of the test. Otherwise, false.
radios_gps :: Lens.Lens' Radios (Prelude.Maybe Prelude.Bool)
radios_gps :: Lens' Radios (Maybe Bool)
radios_gps = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Radios' {Maybe Bool
gps :: Maybe Bool
$sel:gps:Radios' :: Radios -> Maybe Bool
gps} -> Maybe Bool
gps) (\s :: Radios
s@Radios' {} Maybe Bool
a -> Radios
s {$sel:gps:Radios' :: Maybe Bool
gps = Maybe Bool
a} :: Radios)

-- | True if NFC is enabled at the beginning of the test. Otherwise, false.
radios_nfc :: Lens.Lens' Radios (Prelude.Maybe Prelude.Bool)
radios_nfc :: Lens' Radios (Maybe Bool)
radios_nfc = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Radios' {Maybe Bool
nfc :: Maybe Bool
$sel:nfc:Radios' :: Radios -> Maybe Bool
nfc} -> Maybe Bool
nfc) (\s :: Radios
s@Radios' {} Maybe Bool
a -> Radios
s {$sel:nfc:Radios' :: Maybe Bool
nfc = Maybe Bool
a} :: Radios)

-- | True if Wi-Fi is enabled at the beginning of the test. Otherwise, false.
radios_wifi :: Lens.Lens' Radios (Prelude.Maybe Prelude.Bool)
radios_wifi :: Lens' Radios (Maybe Bool)
radios_wifi = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Radios' {Maybe Bool
wifi :: Maybe Bool
$sel:wifi:Radios' :: Radios -> Maybe Bool
wifi} -> Maybe Bool
wifi) (\s :: Radios
s@Radios' {} Maybe Bool
a -> Radios
s {$sel:wifi:Radios' :: Maybe Bool
wifi = Maybe Bool
a} :: Radios)

instance Data.FromJSON Radios where
  parseJSON :: Value -> Parser Radios
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Radios"
      ( \Object
x ->
          Maybe Bool -> Maybe Bool -> Maybe Bool -> Maybe Bool -> Radios
Radios'
            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
"bluetooth")
            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
"gps")
            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
"nfc")
            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
"wifi")
      )

instance Prelude.Hashable Radios where
  hashWithSalt :: Int -> Radios -> Int
hashWithSalt Int
_salt Radios' {Maybe Bool
wifi :: Maybe Bool
nfc :: Maybe Bool
gps :: Maybe Bool
bluetooth :: Maybe Bool
$sel:wifi:Radios' :: Radios -> Maybe Bool
$sel:nfc:Radios' :: Radios -> Maybe Bool
$sel:gps:Radios' :: Radios -> Maybe Bool
$sel:bluetooth:Radios' :: Radios -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
bluetooth
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
gps
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
nfc
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
wifi

instance Prelude.NFData Radios where
  rnf :: Radios -> ()
rnf Radios' {Maybe Bool
wifi :: Maybe Bool
nfc :: Maybe Bool
gps :: Maybe Bool
bluetooth :: Maybe Bool
$sel:wifi:Radios' :: Radios -> Maybe Bool
$sel:nfc:Radios' :: Radios -> Maybe Bool
$sel:gps:Radios' :: Radios -> Maybe Bool
$sel:bluetooth:Radios' :: Radios -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
bluetooth
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
gps
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
nfc
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
wifi

instance Data.ToJSON Radios where
  toJSON :: Radios -> Value
toJSON Radios' {Maybe Bool
wifi :: Maybe Bool
nfc :: Maybe Bool
gps :: Maybe Bool
bluetooth :: Maybe Bool
$sel:wifi:Radios' :: Radios -> Maybe Bool
$sel:nfc:Radios' :: Radios -> Maybe Bool
$sel:gps:Radios' :: Radios -> Maybe Bool
$sel:bluetooth:Radios' :: Radios -> Maybe Bool
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"bluetooth" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
bluetooth,
            (Key
"gps" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
gps,
            (Key
"nfc" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
nfc,
            (Key
"wifi" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
wifi
          ]
      )