{-# 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.Location.Types.ListDevicePositionsResponseEntry
-- 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.Location.Types.ListDevicePositionsResponseEntry where

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

-- | Contains the tracker resource details.
--
-- /See:/ 'newListDevicePositionsResponseEntry' smart constructor.
data ListDevicePositionsResponseEntry = ListDevicePositionsResponseEntry'
  { -- | The ID of the device for this position.
    ListDevicePositionsResponseEntry -> Text
deviceId :: Prelude.Text,
    -- | The last known device position. Empty if no positions currently stored.
    ListDevicePositionsResponseEntry -> Sensitive (NonEmpty Double)
position :: Core.Sensitive (Prelude.NonEmpty Prelude.Double),
    -- | The timestamp at which the device position was determined. Uses
    -- <https://www.iso.org/iso-8601-date-and-time-format.html ISO 8601>
    -- format: @YYYY-MM-DDThh:mm:ss.sssZ@.
    ListDevicePositionsResponseEntry -> POSIX
sampleTime :: Core.POSIX
  }
  deriving (ListDevicePositionsResponseEntry
-> ListDevicePositionsResponseEntry -> Bool
(ListDevicePositionsResponseEntry
 -> ListDevicePositionsResponseEntry -> Bool)
-> (ListDevicePositionsResponseEntry
    -> ListDevicePositionsResponseEntry -> Bool)
-> Eq ListDevicePositionsResponseEntry
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListDevicePositionsResponseEntry
-> ListDevicePositionsResponseEntry -> Bool
$c/= :: ListDevicePositionsResponseEntry
-> ListDevicePositionsResponseEntry -> Bool
== :: ListDevicePositionsResponseEntry
-> ListDevicePositionsResponseEntry -> Bool
$c== :: ListDevicePositionsResponseEntry
-> ListDevicePositionsResponseEntry -> Bool
Prelude.Eq, Int -> ListDevicePositionsResponseEntry -> ShowS
[ListDevicePositionsResponseEntry] -> ShowS
ListDevicePositionsResponseEntry -> String
(Int -> ListDevicePositionsResponseEntry -> ShowS)
-> (ListDevicePositionsResponseEntry -> String)
-> ([ListDevicePositionsResponseEntry] -> ShowS)
-> Show ListDevicePositionsResponseEntry
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListDevicePositionsResponseEntry] -> ShowS
$cshowList :: [ListDevicePositionsResponseEntry] -> ShowS
show :: ListDevicePositionsResponseEntry -> String
$cshow :: ListDevicePositionsResponseEntry -> String
showsPrec :: Int -> ListDevicePositionsResponseEntry -> ShowS
$cshowsPrec :: Int -> ListDevicePositionsResponseEntry -> ShowS
Prelude.Show, (forall x.
 ListDevicePositionsResponseEntry
 -> Rep ListDevicePositionsResponseEntry x)
-> (forall x.
    Rep ListDevicePositionsResponseEntry x
    -> ListDevicePositionsResponseEntry)
-> Generic ListDevicePositionsResponseEntry
forall x.
Rep ListDevicePositionsResponseEntry x
-> ListDevicePositionsResponseEntry
forall x.
ListDevicePositionsResponseEntry
-> Rep ListDevicePositionsResponseEntry x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListDevicePositionsResponseEntry x
-> ListDevicePositionsResponseEntry
$cfrom :: forall x.
ListDevicePositionsResponseEntry
-> Rep ListDevicePositionsResponseEntry x
Prelude.Generic)

-- |
-- Create a value of 'ListDevicePositionsResponseEntry' 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:
--
-- 'deviceId', 'listDevicePositionsResponseEntry_deviceId' - The ID of the device for this position.
--
-- 'position', 'listDevicePositionsResponseEntry_position' - The last known device position. Empty if no positions currently stored.
--
-- 'sampleTime', 'listDevicePositionsResponseEntry_sampleTime' - The timestamp at which the device position was determined. Uses
-- <https://www.iso.org/iso-8601-date-and-time-format.html ISO 8601>
-- format: @YYYY-MM-DDThh:mm:ss.sssZ@.
newListDevicePositionsResponseEntry ::
  -- | 'deviceId'
  Prelude.Text ->
  -- | 'position'
  Prelude.NonEmpty Prelude.Double ->
  -- | 'sampleTime'
  Prelude.UTCTime ->
  ListDevicePositionsResponseEntry
newListDevicePositionsResponseEntry :: Text
-> NonEmpty Double -> UTCTime -> ListDevicePositionsResponseEntry
newListDevicePositionsResponseEntry
  Text
pDeviceId_
  NonEmpty Double
pPosition_
  UTCTime
pSampleTime_ =
    ListDevicePositionsResponseEntry' :: Text
-> Sensitive (NonEmpty Double)
-> POSIX
-> ListDevicePositionsResponseEntry
ListDevicePositionsResponseEntry'
      { $sel:deviceId:ListDevicePositionsResponseEntry' :: Text
deviceId =
          Text
pDeviceId_,
        $sel:position:ListDevicePositionsResponseEntry' :: Sensitive (NonEmpty Double)
position =
          Tagged (NonEmpty Double) (Identity (NonEmpty Double))
-> Tagged
     (Sensitive (NonEmpty Double))
     (Identity (Sensitive (NonEmpty Double)))
forall a. Iso' (Sensitive a) a
Core._Sensitive (Tagged (NonEmpty Double) (Identity (NonEmpty Double))
 -> Tagged
      (Sensitive (NonEmpty Double))
      (Identity (Sensitive (NonEmpty Double))))
-> (Tagged (NonEmpty Double) (Identity (NonEmpty Double))
    -> Tagged (NonEmpty Double) (Identity (NonEmpty Double)))
-> Tagged (NonEmpty Double) (Identity (NonEmpty Double))
-> Tagged
     (Sensitive (NonEmpty Double))
     (Identity (Sensitive (NonEmpty Double)))
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Tagged (NonEmpty Double) (Identity (NonEmpty Double))
-> Tagged (NonEmpty Double) (Identity (NonEmpty Double))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
            (Tagged (NonEmpty Double) (Identity (NonEmpty Double))
 -> Tagged
      (Sensitive (NonEmpty Double))
      (Identity (Sensitive (NonEmpty Double))))
-> NonEmpty Double -> Sensitive (NonEmpty Double)
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Double
pPosition_,
        $sel:sampleTime:ListDevicePositionsResponseEntry' :: POSIX
sampleTime =
          Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pSampleTime_
      }

-- | The ID of the device for this position.
listDevicePositionsResponseEntry_deviceId :: Lens.Lens' ListDevicePositionsResponseEntry Prelude.Text
listDevicePositionsResponseEntry_deviceId :: (Text -> f Text)
-> ListDevicePositionsResponseEntry
-> f ListDevicePositionsResponseEntry
listDevicePositionsResponseEntry_deviceId = (ListDevicePositionsResponseEntry -> Text)
-> (ListDevicePositionsResponseEntry
    -> Text -> ListDevicePositionsResponseEntry)
-> Lens
     ListDevicePositionsResponseEntry
     ListDevicePositionsResponseEntry
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDevicePositionsResponseEntry' {Text
deviceId :: Text
$sel:deviceId:ListDevicePositionsResponseEntry' :: ListDevicePositionsResponseEntry -> Text
deviceId} -> Text
deviceId) (\s :: ListDevicePositionsResponseEntry
s@ListDevicePositionsResponseEntry' {} Text
a -> ListDevicePositionsResponseEntry
s {$sel:deviceId:ListDevicePositionsResponseEntry' :: Text
deviceId = Text
a} :: ListDevicePositionsResponseEntry)

-- | The last known device position. Empty if no positions currently stored.
listDevicePositionsResponseEntry_position :: Lens.Lens' ListDevicePositionsResponseEntry (Prelude.NonEmpty Prelude.Double)
listDevicePositionsResponseEntry_position :: (NonEmpty Double -> f (NonEmpty Double))
-> ListDevicePositionsResponseEntry
-> f ListDevicePositionsResponseEntry
listDevicePositionsResponseEntry_position = (ListDevicePositionsResponseEntry -> Sensitive (NonEmpty Double))
-> (ListDevicePositionsResponseEntry
    -> Sensitive (NonEmpty Double) -> ListDevicePositionsResponseEntry)
-> Lens
     ListDevicePositionsResponseEntry
     ListDevicePositionsResponseEntry
     (Sensitive (NonEmpty Double))
     (Sensitive (NonEmpty Double))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDevicePositionsResponseEntry' {Sensitive (NonEmpty Double)
position :: Sensitive (NonEmpty Double)
$sel:position:ListDevicePositionsResponseEntry' :: ListDevicePositionsResponseEntry -> Sensitive (NonEmpty Double)
position} -> Sensitive (NonEmpty Double)
position) (\s :: ListDevicePositionsResponseEntry
s@ListDevicePositionsResponseEntry' {} Sensitive (NonEmpty Double)
a -> ListDevicePositionsResponseEntry
s {$sel:position:ListDevicePositionsResponseEntry' :: Sensitive (NonEmpty Double)
position = Sensitive (NonEmpty Double)
a} :: ListDevicePositionsResponseEntry) ((Sensitive (NonEmpty Double) -> f (Sensitive (NonEmpty Double)))
 -> ListDevicePositionsResponseEntry
 -> f ListDevicePositionsResponseEntry)
-> ((NonEmpty Double -> f (NonEmpty Double))
    -> Sensitive (NonEmpty Double) -> f (Sensitive (NonEmpty Double)))
-> (NonEmpty Double -> f (NonEmpty Double))
-> ListDevicePositionsResponseEntry
-> f ListDevicePositionsResponseEntry
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Double -> f (NonEmpty Double))
-> Sensitive (NonEmpty Double) -> f (Sensitive (NonEmpty Double))
forall a. Iso' (Sensitive a) a
Core._Sensitive ((NonEmpty Double -> f (NonEmpty Double))
 -> Sensitive (NonEmpty Double) -> f (Sensitive (NonEmpty Double)))
-> ((NonEmpty Double -> f (NonEmpty Double))
    -> NonEmpty Double -> f (NonEmpty Double))
-> (NonEmpty Double -> f (NonEmpty Double))
-> Sensitive (NonEmpty Double)
-> f (Sensitive (NonEmpty Double))
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Double -> f (NonEmpty Double))
-> NonEmpty Double -> f (NonEmpty Double)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The timestamp at which the device position was determined. Uses
-- <https://www.iso.org/iso-8601-date-and-time-format.html ISO 8601>
-- format: @YYYY-MM-DDThh:mm:ss.sssZ@.
listDevicePositionsResponseEntry_sampleTime :: Lens.Lens' ListDevicePositionsResponseEntry Prelude.UTCTime
listDevicePositionsResponseEntry_sampleTime :: (UTCTime -> f UTCTime)
-> ListDevicePositionsResponseEntry
-> f ListDevicePositionsResponseEntry
listDevicePositionsResponseEntry_sampleTime = (ListDevicePositionsResponseEntry -> POSIX)
-> (ListDevicePositionsResponseEntry
    -> POSIX -> ListDevicePositionsResponseEntry)
-> Lens
     ListDevicePositionsResponseEntry
     ListDevicePositionsResponseEntry
     POSIX
     POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDevicePositionsResponseEntry' {POSIX
sampleTime :: POSIX
$sel:sampleTime:ListDevicePositionsResponseEntry' :: ListDevicePositionsResponseEntry -> POSIX
sampleTime} -> POSIX
sampleTime) (\s :: ListDevicePositionsResponseEntry
s@ListDevicePositionsResponseEntry' {} POSIX
a -> ListDevicePositionsResponseEntry
s {$sel:sampleTime:ListDevicePositionsResponseEntry' :: POSIX
sampleTime = POSIX
a} :: ListDevicePositionsResponseEntry) ((POSIX -> f POSIX)
 -> ListDevicePositionsResponseEntry
 -> f ListDevicePositionsResponseEntry)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> ListDevicePositionsResponseEntry
-> f ListDevicePositionsResponseEntry
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

instance
  Core.FromJSON
    ListDevicePositionsResponseEntry
  where
  parseJSON :: Value -> Parser ListDevicePositionsResponseEntry
parseJSON =
    String
-> (Object -> Parser ListDevicePositionsResponseEntry)
-> Value
-> Parser ListDevicePositionsResponseEntry
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ListDevicePositionsResponseEntry"
      ( \Object
x ->
          Text
-> Sensitive (NonEmpty Double)
-> POSIX
-> ListDevicePositionsResponseEntry
ListDevicePositionsResponseEntry'
            (Text
 -> Sensitive (NonEmpty Double)
 -> POSIX
 -> ListDevicePositionsResponseEntry)
-> Parser Text
-> Parser
     (Sensitive (NonEmpty Double)
      -> POSIX -> ListDevicePositionsResponseEntry)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"DeviceId")
            Parser
  (Sensitive (NonEmpty Double)
   -> POSIX -> ListDevicePositionsResponseEntry)
-> Parser (Sensitive (NonEmpty Double))
-> Parser (POSIX -> ListDevicePositionsResponseEntry)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Sensitive (NonEmpty Double))
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Position")
            Parser (POSIX -> ListDevicePositionsResponseEntry)
-> Parser POSIX -> Parser ListDevicePositionsResponseEntry
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser POSIX
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"SampleTime")
      )

instance
  Prelude.Hashable
    ListDevicePositionsResponseEntry

instance
  Prelude.NFData
    ListDevicePositionsResponseEntry