{-# 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.DevicePosition 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 DevicePosition = DevicePosition'
{
DevicePosition -> Maybe PositionalAccuracy
accuracy :: Prelude.Maybe PositionalAccuracy,
DevicePosition -> Maybe Text
deviceId :: Prelude.Maybe Prelude.Text,
DevicePosition -> Maybe (Sensitive (HashMap Text Text))
positionProperties :: Prelude.Maybe (Data.Sensitive (Prelude.HashMap Prelude.Text Prelude.Text)),
DevicePosition -> Sensitive (NonEmpty Double)
position :: Data.Sensitive (Prelude.NonEmpty Prelude.Double),
DevicePosition -> ISO8601
receivedTime :: Data.ISO8601,
DevicePosition -> ISO8601
sampleTime :: Data.ISO8601
}
deriving (DevicePosition -> DevicePosition -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DevicePosition -> DevicePosition -> Bool
$c/= :: DevicePosition -> DevicePosition -> Bool
== :: DevicePosition -> DevicePosition -> Bool
$c== :: DevicePosition -> DevicePosition -> Bool
Prelude.Eq, Int -> DevicePosition -> ShowS
[DevicePosition] -> ShowS
DevicePosition -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DevicePosition] -> ShowS
$cshowList :: [DevicePosition] -> ShowS
show :: DevicePosition -> String
$cshow :: DevicePosition -> String
showsPrec :: Int -> DevicePosition -> ShowS
$cshowsPrec :: Int -> DevicePosition -> ShowS
Prelude.Show, forall x. Rep DevicePosition x -> DevicePosition
forall x. DevicePosition -> Rep DevicePosition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DevicePosition x -> DevicePosition
$cfrom :: forall x. DevicePosition -> Rep DevicePosition x
Prelude.Generic)
newDevicePosition ::
Prelude.NonEmpty Prelude.Double ->
Prelude.UTCTime ->
Prelude.UTCTime ->
DevicePosition
newDevicePosition :: NonEmpty Double -> UTCTime -> UTCTime -> DevicePosition
newDevicePosition
NonEmpty Double
pPosition_
UTCTime
pReceivedTime_
UTCTime
pSampleTime_ =
DevicePosition'
{ $sel:accuracy:DevicePosition' :: Maybe PositionalAccuracy
accuracy = forall a. Maybe a
Prelude.Nothing,
$sel:deviceId:DevicePosition' :: Maybe Text
deviceId = forall a. Maybe a
Prelude.Nothing,
$sel:positionProperties:DevicePosition' :: Maybe (Sensitive (HashMap Text Text))
positionProperties = forall a. Maybe a
Prelude.Nothing,
$sel:position:DevicePosition' :: 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:receivedTime:DevicePosition' :: ISO8601
receivedTime = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pReceivedTime_,
$sel:sampleTime:DevicePosition' :: ISO8601
sampleTime = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pSampleTime_
}
devicePosition_accuracy :: Lens.Lens' DevicePosition (Prelude.Maybe PositionalAccuracy)
devicePosition_accuracy :: Lens' DevicePosition (Maybe PositionalAccuracy)
devicePosition_accuracy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DevicePosition' {Maybe PositionalAccuracy
accuracy :: Maybe PositionalAccuracy
$sel:accuracy:DevicePosition' :: DevicePosition -> Maybe PositionalAccuracy
accuracy} -> Maybe PositionalAccuracy
accuracy) (\s :: DevicePosition
s@DevicePosition' {} Maybe PositionalAccuracy
a -> DevicePosition
s {$sel:accuracy:DevicePosition' :: Maybe PositionalAccuracy
accuracy = Maybe PositionalAccuracy
a} :: DevicePosition)
devicePosition_deviceId :: Lens.Lens' DevicePosition (Prelude.Maybe Prelude.Text)
devicePosition_deviceId :: Lens' DevicePosition (Maybe Text)
devicePosition_deviceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DevicePosition' {Maybe Text
deviceId :: Maybe Text
$sel:deviceId:DevicePosition' :: DevicePosition -> Maybe Text
deviceId} -> Maybe Text
deviceId) (\s :: DevicePosition
s@DevicePosition' {} Maybe Text
a -> DevicePosition
s {$sel:deviceId:DevicePosition' :: Maybe Text
deviceId = Maybe Text
a} :: DevicePosition)
devicePosition_positionProperties :: Lens.Lens' DevicePosition (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
devicePosition_positionProperties :: Lens' DevicePosition (Maybe (HashMap Text Text))
devicePosition_positionProperties = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DevicePosition' {Maybe (Sensitive (HashMap Text Text))
positionProperties :: Maybe (Sensitive (HashMap Text Text))
$sel:positionProperties:DevicePosition' :: DevicePosition -> Maybe (Sensitive (HashMap Text Text))
positionProperties} -> Maybe (Sensitive (HashMap Text Text))
positionProperties) (\s :: DevicePosition
s@DevicePosition' {} Maybe (Sensitive (HashMap Text Text))
a -> DevicePosition
s {$sel:positionProperties:DevicePosition' :: Maybe (Sensitive (HashMap Text Text))
positionProperties = Maybe (Sensitive (HashMap Text Text))
a} :: DevicePosition) 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)
devicePosition_position :: Lens.Lens' DevicePosition (Prelude.NonEmpty Prelude.Double)
devicePosition_position :: Lens' DevicePosition (NonEmpty Double)
devicePosition_position = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DevicePosition' {Sensitive (NonEmpty Double)
position :: Sensitive (NonEmpty Double)
$sel:position:DevicePosition' :: DevicePosition -> Sensitive (NonEmpty Double)
position} -> Sensitive (NonEmpty Double)
position) (\s :: DevicePosition
s@DevicePosition' {} Sensitive (NonEmpty Double)
a -> DevicePosition
s {$sel:position:DevicePosition' :: Sensitive (NonEmpty Double)
position = Sensitive (NonEmpty Double)
a} :: DevicePosition) 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
devicePosition_receivedTime :: Lens.Lens' DevicePosition Prelude.UTCTime
devicePosition_receivedTime :: Lens' DevicePosition UTCTime
devicePosition_receivedTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DevicePosition' {ISO8601
receivedTime :: ISO8601
$sel:receivedTime:DevicePosition' :: DevicePosition -> ISO8601
receivedTime} -> ISO8601
receivedTime) (\s :: DevicePosition
s@DevicePosition' {} ISO8601
a -> DevicePosition
s {$sel:receivedTime:DevicePosition' :: ISO8601
receivedTime = ISO8601
a} :: DevicePosition) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time
devicePosition_sampleTime :: Lens.Lens' DevicePosition Prelude.UTCTime
devicePosition_sampleTime :: Lens' DevicePosition UTCTime
devicePosition_sampleTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DevicePosition' {ISO8601
sampleTime :: ISO8601
$sel:sampleTime:DevicePosition' :: DevicePosition -> ISO8601
sampleTime} -> ISO8601
sampleTime) (\s :: DevicePosition
s@DevicePosition' {} ISO8601
a -> DevicePosition
s {$sel:sampleTime:DevicePosition' :: ISO8601
sampleTime = ISO8601
a} :: DevicePosition) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time
instance Data.FromJSON DevicePosition where
parseJSON :: Value -> Parser DevicePosition
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"DevicePosition"
( \Object
x ->
Maybe PositionalAccuracy
-> Maybe Text
-> Maybe (Sensitive (HashMap Text Text))
-> Sensitive (NonEmpty Double)
-> ISO8601
-> ISO8601
-> DevicePosition
DevicePosition'
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
"Accuracy")
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
"DeviceId")
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
"PositionProperties"
forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Position")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"ReceivedTime")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"SampleTime")
)
instance Prelude.Hashable DevicePosition where
hashWithSalt :: Int -> DevicePosition -> Int
hashWithSalt Int
_salt DevicePosition' {Maybe Text
Maybe (Sensitive (HashMap Text Text))
Maybe PositionalAccuracy
Sensitive (NonEmpty Double)
ISO8601
sampleTime :: ISO8601
receivedTime :: ISO8601
position :: Sensitive (NonEmpty Double)
positionProperties :: Maybe (Sensitive (HashMap Text Text))
deviceId :: Maybe Text
accuracy :: Maybe PositionalAccuracy
$sel:sampleTime:DevicePosition' :: DevicePosition -> ISO8601
$sel:receivedTime:DevicePosition' :: DevicePosition -> ISO8601
$sel:position:DevicePosition' :: DevicePosition -> Sensitive (NonEmpty Double)
$sel:positionProperties:DevicePosition' :: DevicePosition -> Maybe (Sensitive (HashMap Text Text))
$sel:deviceId:DevicePosition' :: DevicePosition -> Maybe Text
$sel:accuracy:DevicePosition' :: DevicePosition -> 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 Text
deviceId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive (HashMap Text Text))
positionProperties
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Sensitive (NonEmpty Double)
position
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ISO8601
receivedTime
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ISO8601
sampleTime
instance Prelude.NFData DevicePosition where
rnf :: DevicePosition -> ()
rnf DevicePosition' {Maybe Text
Maybe (Sensitive (HashMap Text Text))
Maybe PositionalAccuracy
Sensitive (NonEmpty Double)
ISO8601
sampleTime :: ISO8601
receivedTime :: ISO8601
position :: Sensitive (NonEmpty Double)
positionProperties :: Maybe (Sensitive (HashMap Text Text))
deviceId :: Maybe Text
accuracy :: Maybe PositionalAccuracy
$sel:sampleTime:DevicePosition' :: DevicePosition -> ISO8601
$sel:receivedTime:DevicePosition' :: DevicePosition -> ISO8601
$sel:position:DevicePosition' :: DevicePosition -> Sensitive (NonEmpty Double)
$sel:positionProperties:DevicePosition' :: DevicePosition -> Maybe (Sensitive (HashMap Text Text))
$sel:deviceId:DevicePosition' :: DevicePosition -> Maybe Text
$sel:accuracy:DevicePosition' :: DevicePosition -> 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 Text
deviceId
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 Sensitive (NonEmpty Double)
position
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ISO8601
receivedTime
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ISO8601
sampleTime