{-# 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.Location.Types.DevicePositionUpdate where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Location.Types.PositionalAccuracy
import qualified Amazonka.Prelude as Prelude
data DevicePositionUpdate = DevicePositionUpdate'
{
DevicePositionUpdate -> Maybe PositionalAccuracy
accuracy :: Prelude.Maybe PositionalAccuracy,
DevicePositionUpdate -> Maybe (Sensitive (HashMap Text Text))
positionProperties :: Prelude.Maybe (Data.Sensitive (Prelude.HashMap Prelude.Text Prelude.Text)),
DevicePositionUpdate -> Text
deviceId :: Prelude.Text,
DevicePositionUpdate -> Sensitive (NonEmpty Double)
position :: Data.Sensitive (Prelude.NonEmpty Prelude.Double),
DevicePositionUpdate -> ISO8601
sampleTime :: Data.ISO8601
}
deriving (DevicePositionUpdate -> DevicePositionUpdate -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DevicePositionUpdate -> DevicePositionUpdate -> Bool
$c/= :: DevicePositionUpdate -> DevicePositionUpdate -> Bool
== :: DevicePositionUpdate -> DevicePositionUpdate -> Bool
$c== :: DevicePositionUpdate -> DevicePositionUpdate -> Bool
Prelude.Eq, Int -> DevicePositionUpdate -> ShowS
[DevicePositionUpdate] -> ShowS
DevicePositionUpdate -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DevicePositionUpdate] -> ShowS
$cshowList :: [DevicePositionUpdate] -> ShowS
show :: DevicePositionUpdate -> String
$cshow :: DevicePositionUpdate -> String
showsPrec :: Int -> DevicePositionUpdate -> ShowS
$cshowsPrec :: Int -> DevicePositionUpdate -> ShowS
Prelude.Show, forall x. Rep DevicePositionUpdate x -> DevicePositionUpdate
forall x. DevicePositionUpdate -> Rep DevicePositionUpdate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DevicePositionUpdate x -> DevicePositionUpdate
$cfrom :: forall x. DevicePositionUpdate -> Rep DevicePositionUpdate x
Prelude.Generic)
newDevicePositionUpdate ::
Prelude.Text ->
Prelude.NonEmpty Prelude.Double ->
Prelude.UTCTime ->
DevicePositionUpdate
newDevicePositionUpdate :: Text -> NonEmpty Double -> UTCTime -> DevicePositionUpdate
newDevicePositionUpdate
Text
pDeviceId_
NonEmpty Double
pPosition_
UTCTime
pSampleTime_ =
DevicePositionUpdate'
{ $sel:accuracy:DevicePositionUpdate' :: Maybe PositionalAccuracy
accuracy = forall a. Maybe a
Prelude.Nothing,
$sel:positionProperties:DevicePositionUpdate' :: Maybe (Sensitive (HashMap Text Text))
positionProperties = forall a. Maybe a
Prelude.Nothing,
$sel:deviceId:DevicePositionUpdate' :: Text
deviceId = Text
pDeviceId_,
$sel:position:DevicePositionUpdate' :: Sensitive (NonEmpty Double)
position =
forall a. Iso' (Sensitive a) a
Data._Sensitive
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Double
pPosition_,
$sel:sampleTime:DevicePositionUpdate' :: ISO8601
sampleTime = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pSampleTime_
}
devicePositionUpdate_accuracy :: Lens.Lens' DevicePositionUpdate (Prelude.Maybe PositionalAccuracy)
devicePositionUpdate_accuracy :: Lens' DevicePositionUpdate (Maybe PositionalAccuracy)
devicePositionUpdate_accuracy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DevicePositionUpdate' {Maybe PositionalAccuracy
accuracy :: Maybe PositionalAccuracy
$sel:accuracy:DevicePositionUpdate' :: DevicePositionUpdate -> Maybe PositionalAccuracy
accuracy} -> Maybe PositionalAccuracy
accuracy) (\s :: DevicePositionUpdate
s@DevicePositionUpdate' {} Maybe PositionalAccuracy
a -> DevicePositionUpdate
s {$sel:accuracy:DevicePositionUpdate' :: Maybe PositionalAccuracy
accuracy = Maybe PositionalAccuracy
a} :: DevicePositionUpdate)
devicePositionUpdate_positionProperties :: Lens.Lens' DevicePositionUpdate (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
devicePositionUpdate_positionProperties :: Lens' DevicePositionUpdate (Maybe (HashMap Text Text))
devicePositionUpdate_positionProperties = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DevicePositionUpdate' {Maybe (Sensitive (HashMap Text Text))
positionProperties :: Maybe (Sensitive (HashMap Text Text))
$sel:positionProperties:DevicePositionUpdate' :: DevicePositionUpdate -> Maybe (Sensitive (HashMap Text Text))
positionProperties} -> Maybe (Sensitive (HashMap Text Text))
positionProperties) (\s :: DevicePositionUpdate
s@DevicePositionUpdate' {} Maybe (Sensitive (HashMap Text Text))
a -> DevicePositionUpdate
s {$sel:positionProperties:DevicePositionUpdate' :: Maybe (Sensitive (HashMap Text Text))
positionProperties = Maybe (Sensitive (HashMap Text Text))
a} :: DevicePositionUpdate) 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 a. Iso' (Sensitive a) a
Data._Sensitive forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced)
devicePositionUpdate_deviceId :: Lens.Lens' DevicePositionUpdate Prelude.Text
devicePositionUpdate_deviceId :: Lens' DevicePositionUpdate Text
devicePositionUpdate_deviceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DevicePositionUpdate' {Text
deviceId :: Text
$sel:deviceId:DevicePositionUpdate' :: DevicePositionUpdate -> Text
deviceId} -> Text
deviceId) (\s :: DevicePositionUpdate
s@DevicePositionUpdate' {} Text
a -> DevicePositionUpdate
s {$sel:deviceId:DevicePositionUpdate' :: Text
deviceId = Text
a} :: DevicePositionUpdate)
devicePositionUpdate_position :: Lens.Lens' DevicePositionUpdate (Prelude.NonEmpty Prelude.Double)
devicePositionUpdate_position :: Lens' DevicePositionUpdate (NonEmpty Double)
devicePositionUpdate_position = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DevicePositionUpdate' {Sensitive (NonEmpty Double)
position :: Sensitive (NonEmpty Double)
$sel:position:DevicePositionUpdate' :: DevicePositionUpdate -> Sensitive (NonEmpty Double)
position} -> Sensitive (NonEmpty Double)
position) (\s :: DevicePositionUpdate
s@DevicePositionUpdate' {} Sensitive (NonEmpty Double)
a -> DevicePositionUpdate
s {$sel:position:DevicePositionUpdate' :: Sensitive (NonEmpty Double)
position = Sensitive (NonEmpty Double)
a} :: DevicePositionUpdate) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a. Iso' (Sensitive a) a
Data._Sensitive forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
devicePositionUpdate_sampleTime :: Lens.Lens' DevicePositionUpdate Prelude.UTCTime
devicePositionUpdate_sampleTime :: Lens' DevicePositionUpdate UTCTime
devicePositionUpdate_sampleTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DevicePositionUpdate' {ISO8601
sampleTime :: ISO8601
$sel:sampleTime:DevicePositionUpdate' :: DevicePositionUpdate -> ISO8601
sampleTime} -> ISO8601
sampleTime) (\s :: DevicePositionUpdate
s@DevicePositionUpdate' {} ISO8601
a -> DevicePositionUpdate
s {$sel:sampleTime:DevicePositionUpdate' :: ISO8601
sampleTime = ISO8601
a} :: DevicePositionUpdate) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time
instance Prelude.Hashable DevicePositionUpdate where
hashWithSalt :: Int -> DevicePositionUpdate -> Int
hashWithSalt Int
_salt DevicePositionUpdate' {Maybe (Sensitive (HashMap Text Text))
Maybe PositionalAccuracy
Text
Sensitive (NonEmpty Double)
ISO8601
sampleTime :: ISO8601
position :: Sensitive (NonEmpty Double)
deviceId :: Text
positionProperties :: Maybe (Sensitive (HashMap Text Text))
accuracy :: Maybe PositionalAccuracy
$sel:sampleTime:DevicePositionUpdate' :: DevicePositionUpdate -> ISO8601
$sel:position:DevicePositionUpdate' :: DevicePositionUpdate -> Sensitive (NonEmpty Double)
$sel:deviceId:DevicePositionUpdate' :: DevicePositionUpdate -> Text
$sel:positionProperties:DevicePositionUpdate' :: DevicePositionUpdate -> Maybe (Sensitive (HashMap Text Text))
$sel:accuracy:DevicePositionUpdate' :: DevicePositionUpdate -> Maybe PositionalAccuracy
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe PositionalAccuracy
accuracy
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive (HashMap Text Text))
positionProperties
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
deviceId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Sensitive (NonEmpty Double)
position
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ISO8601
sampleTime
instance Prelude.NFData DevicePositionUpdate where
rnf :: DevicePositionUpdate -> ()
rnf DevicePositionUpdate' {Maybe (Sensitive (HashMap Text Text))
Maybe PositionalAccuracy
Text
Sensitive (NonEmpty Double)
ISO8601
sampleTime :: ISO8601
position :: Sensitive (NonEmpty Double)
deviceId :: Text
positionProperties :: Maybe (Sensitive (HashMap Text Text))
accuracy :: Maybe PositionalAccuracy
$sel:sampleTime:DevicePositionUpdate' :: DevicePositionUpdate -> ISO8601
$sel:position:DevicePositionUpdate' :: DevicePositionUpdate -> Sensitive (NonEmpty Double)
$sel:deviceId:DevicePositionUpdate' :: DevicePositionUpdate -> Text
$sel:positionProperties:DevicePositionUpdate' :: DevicePositionUpdate -> Maybe (Sensitive (HashMap Text Text))
$sel:accuracy:DevicePositionUpdate' :: DevicePositionUpdate -> Maybe PositionalAccuracy
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe PositionalAccuracy
accuracy
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive (HashMap Text Text))
positionProperties
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
deviceId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Sensitive (NonEmpty Double)
position
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ISO8601
sampleTime
instance Data.ToJSON DevicePositionUpdate where
toJSON :: DevicePositionUpdate -> Value
toJSON DevicePositionUpdate' {Maybe (Sensitive (HashMap Text Text))
Maybe PositionalAccuracy
Text
Sensitive (NonEmpty Double)
ISO8601
sampleTime :: ISO8601
position :: Sensitive (NonEmpty Double)
deviceId :: Text
positionProperties :: Maybe (Sensitive (HashMap Text Text))
accuracy :: Maybe PositionalAccuracy
$sel:sampleTime:DevicePositionUpdate' :: DevicePositionUpdate -> ISO8601
$sel:position:DevicePositionUpdate' :: DevicePositionUpdate -> Sensitive (NonEmpty Double)
$sel:deviceId:DevicePositionUpdate' :: DevicePositionUpdate -> Text
$sel:positionProperties:DevicePositionUpdate' :: DevicePositionUpdate -> Maybe (Sensitive (HashMap Text Text))
$sel:accuracy:DevicePositionUpdate' :: DevicePositionUpdate -> Maybe PositionalAccuracy
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"Accuracy" 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 PositionalAccuracy
accuracy,
(Key
"PositionProperties" 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 (Sensitive (HashMap Text Text))
positionProperties,
forall a. a -> Maybe a
Prelude.Just (Key
"DeviceId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
deviceId),
forall a. a -> Maybe a
Prelude.Just (Key
"Position" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Sensitive (NonEmpty Double)
position),
forall a. a -> Maybe a
Prelude.Just (Key
"SampleTime" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ISO8601
sampleTime)
]
)