{-# 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 #-}
module Amazonka.IoTWireless.Types.Beaconing 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
data Beaconing = Beaconing'
{
Beaconing -> Maybe Natural
dataRate :: Prelude.Maybe Prelude.Natural,
Beaconing -> Maybe [Natural]
frequencies :: Prelude.Maybe [Prelude.Natural]
}
deriving (Beaconing -> Beaconing -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Beaconing -> Beaconing -> Bool
$c/= :: Beaconing -> Beaconing -> Bool
== :: Beaconing -> Beaconing -> Bool
$c== :: Beaconing -> Beaconing -> Bool
Prelude.Eq, ReadPrec [Beaconing]
ReadPrec Beaconing
Int -> ReadS Beaconing
ReadS [Beaconing]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Beaconing]
$creadListPrec :: ReadPrec [Beaconing]
readPrec :: ReadPrec Beaconing
$creadPrec :: ReadPrec Beaconing
readList :: ReadS [Beaconing]
$creadList :: ReadS [Beaconing]
readsPrec :: Int -> ReadS Beaconing
$creadsPrec :: Int -> ReadS Beaconing
Prelude.Read, Int -> Beaconing -> ShowS
[Beaconing] -> ShowS
Beaconing -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Beaconing] -> ShowS
$cshowList :: [Beaconing] -> ShowS
show :: Beaconing -> String
$cshow :: Beaconing -> String
showsPrec :: Int -> Beaconing -> ShowS
$cshowsPrec :: Int -> Beaconing -> ShowS
Prelude.Show, forall x. Rep Beaconing x -> Beaconing
forall x. Beaconing -> Rep Beaconing x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Beaconing x -> Beaconing
$cfrom :: forall x. Beaconing -> Rep Beaconing x
Prelude.Generic)
newBeaconing ::
Beaconing
newBeaconing :: Beaconing
newBeaconing =
Beaconing'
{ $sel:dataRate:Beaconing' :: Maybe Natural
dataRate = forall a. Maybe a
Prelude.Nothing,
$sel:frequencies:Beaconing' :: Maybe [Natural]
frequencies = forall a. Maybe a
Prelude.Nothing
}
beaconing_dataRate :: Lens.Lens' Beaconing (Prelude.Maybe Prelude.Natural)
beaconing_dataRate :: Lens' Beaconing (Maybe Natural)
beaconing_dataRate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Beaconing' {Maybe Natural
dataRate :: Maybe Natural
$sel:dataRate:Beaconing' :: Beaconing -> Maybe Natural
dataRate} -> Maybe Natural
dataRate) (\s :: Beaconing
s@Beaconing' {} Maybe Natural
a -> Beaconing
s {$sel:dataRate:Beaconing' :: Maybe Natural
dataRate = Maybe Natural
a} :: Beaconing)
beaconing_frequencies :: Lens.Lens' Beaconing (Prelude.Maybe [Prelude.Natural])
beaconing_frequencies :: Lens' Beaconing (Maybe [Natural])
beaconing_frequencies = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Beaconing' {Maybe [Natural]
frequencies :: Maybe [Natural]
$sel:frequencies:Beaconing' :: Beaconing -> Maybe [Natural]
frequencies} -> Maybe [Natural]
frequencies) (\s :: Beaconing
s@Beaconing' {} Maybe [Natural]
a -> Beaconing
s {$sel:frequencies:Beaconing' :: Maybe [Natural]
frequencies = Maybe [Natural]
a} :: Beaconing) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Data.FromJSON Beaconing where
parseJSON :: Value -> Parser Beaconing
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"Beaconing"
( \Object
x ->
Maybe Natural -> Maybe [Natural] -> Beaconing
Beaconing'
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
"DataRate")
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
"Frequencies" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable Beaconing where
hashWithSalt :: Int -> Beaconing -> Int
hashWithSalt Int
_salt Beaconing' {Maybe Natural
Maybe [Natural]
frequencies :: Maybe [Natural]
dataRate :: Maybe Natural
$sel:frequencies:Beaconing' :: Beaconing -> Maybe [Natural]
$sel:dataRate:Beaconing' :: Beaconing -> Maybe Natural
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
dataRate
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Natural]
frequencies
instance Prelude.NFData Beaconing where
rnf :: Beaconing -> ()
rnf Beaconing' {Maybe Natural
Maybe [Natural]
frequencies :: Maybe [Natural]
dataRate :: Maybe Natural
$sel:frequencies:Beaconing' :: Beaconing -> Maybe [Natural]
$sel:dataRate:Beaconing' :: Beaconing -> Maybe Natural
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
dataRate
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Natural]
frequencies
instance Data.ToJSON Beaconing where
toJSON :: Beaconing -> Value
toJSON Beaconing' {Maybe Natural
Maybe [Natural]
frequencies :: Maybe [Natural]
dataRate :: Maybe Natural
$sel:frequencies:Beaconing' :: Beaconing -> Maybe [Natural]
$sel:dataRate:Beaconing' :: Beaconing -> Maybe Natural
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"DataRate" 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 Natural
dataRate,
(Key
"Frequencies" 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 [Natural]
frequencies
]
)