{-# 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.Step 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 Step = Step'
{
Step -> Maybe Natural
geometryOffset :: Prelude.Maybe Prelude.Natural,
Step -> Double
distance :: Prelude.Double,
Step -> Double
durationSeconds :: Prelude.Double,
Step -> Sensitive (NonEmpty Double)
endPosition :: Data.Sensitive (Prelude.NonEmpty Prelude.Double),
Step -> Sensitive (NonEmpty Double)
startPosition :: Data.Sensitive (Prelude.NonEmpty Prelude.Double)
}
deriving (Step -> Step -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Step -> Step -> Bool
$c/= :: Step -> Step -> Bool
== :: Step -> Step -> Bool
$c== :: Step -> Step -> Bool
Prelude.Eq, Int -> Step -> ShowS
[Step] -> ShowS
Step -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Step] -> ShowS
$cshowList :: [Step] -> ShowS
show :: Step -> String
$cshow :: Step -> String
showsPrec :: Int -> Step -> ShowS
$cshowsPrec :: Int -> Step -> ShowS
Prelude.Show, forall x. Rep Step x -> Step
forall x. Step -> Rep Step x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Step x -> Step
$cfrom :: forall x. Step -> Rep Step x
Prelude.Generic)
newStep ::
Prelude.Double ->
Prelude.Double ->
Prelude.NonEmpty Prelude.Double ->
Prelude.NonEmpty Prelude.Double ->
Step
newStep :: Double -> Double -> NonEmpty Double -> NonEmpty Double -> Step
newStep
Double
pDistance_
Double
pDurationSeconds_
NonEmpty Double
pEndPosition_
NonEmpty Double
pStartPosition_ =
Step'
{ $sel:geometryOffset:Step' :: Maybe Natural
geometryOffset = forall a. Maybe a
Prelude.Nothing,
$sel:distance:Step' :: Double
distance = Double
pDistance_,
$sel:durationSeconds:Step' :: Double
durationSeconds = Double
pDurationSeconds_,
$sel:endPosition:Step' :: Sensitive (NonEmpty Double)
endPosition =
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
pEndPosition_,
$sel:startPosition:Step' :: Sensitive (NonEmpty Double)
startPosition =
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
pStartPosition_
}
step_geometryOffset :: Lens.Lens' Step (Prelude.Maybe Prelude.Natural)
step_geometryOffset :: Lens' Step (Maybe Natural)
step_geometryOffset = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Step' {Maybe Natural
geometryOffset :: Maybe Natural
$sel:geometryOffset:Step' :: Step -> Maybe Natural
geometryOffset} -> Maybe Natural
geometryOffset) (\s :: Step
s@Step' {} Maybe Natural
a -> Step
s {$sel:geometryOffset:Step' :: Maybe Natural
geometryOffset = Maybe Natural
a} :: Step)
step_distance :: Lens.Lens' Step Prelude.Double
step_distance :: Lens' Step Double
step_distance = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Step' {Double
distance :: Double
$sel:distance:Step' :: Step -> Double
distance} -> Double
distance) (\s :: Step
s@Step' {} Double
a -> Step
s {$sel:distance:Step' :: Double
distance = Double
a} :: Step)
step_durationSeconds :: Lens.Lens' Step Prelude.Double
step_durationSeconds :: Lens' Step Double
step_durationSeconds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Step' {Double
durationSeconds :: Double
$sel:durationSeconds:Step' :: Step -> Double
durationSeconds} -> Double
durationSeconds) (\s :: Step
s@Step' {} Double
a -> Step
s {$sel:durationSeconds:Step' :: Double
durationSeconds = Double
a} :: Step)
step_endPosition :: Lens.Lens' Step (Prelude.NonEmpty Prelude.Double)
step_endPosition :: Lens' Step (NonEmpty Double)
step_endPosition = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Step' {Sensitive (NonEmpty Double)
endPosition :: Sensitive (NonEmpty Double)
$sel:endPosition:Step' :: Step -> Sensitive (NonEmpty Double)
endPosition} -> Sensitive (NonEmpty Double)
endPosition) (\s :: Step
s@Step' {} Sensitive (NonEmpty Double)
a -> Step
s {$sel:endPosition:Step' :: Sensitive (NonEmpty Double)
endPosition = Sensitive (NonEmpty Double)
a} :: Step) 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
step_startPosition :: Lens.Lens' Step (Prelude.NonEmpty Prelude.Double)
step_startPosition :: Lens' Step (NonEmpty Double)
step_startPosition = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Step' {Sensitive (NonEmpty Double)
startPosition :: Sensitive (NonEmpty Double)
$sel:startPosition:Step' :: Step -> Sensitive (NonEmpty Double)
startPosition} -> Sensitive (NonEmpty Double)
startPosition) (\s :: Step
s@Step' {} Sensitive (NonEmpty Double)
a -> Step
s {$sel:startPosition:Step' :: Sensitive (NonEmpty Double)
startPosition = Sensitive (NonEmpty Double)
a} :: Step) 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
instance Data.FromJSON Step where
parseJSON :: Value -> Parser Step
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"Step"
( \Object
x ->
Maybe Natural
-> Double
-> Double
-> Sensitive (NonEmpty Double)
-> Sensitive (NonEmpty Double)
-> Step
Step'
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
"GeometryOffset")
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
"Distance")
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
"DurationSeconds")
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
"EndPosition")
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
"StartPosition")
)
instance Prelude.Hashable Step where
hashWithSalt :: Int -> Step -> Int
hashWithSalt Int
_salt Step' {Double
Maybe Natural
Sensitive (NonEmpty Double)
startPosition :: Sensitive (NonEmpty Double)
endPosition :: Sensitive (NonEmpty Double)
durationSeconds :: Double
distance :: Double
geometryOffset :: Maybe Natural
$sel:startPosition:Step' :: Step -> Sensitive (NonEmpty Double)
$sel:endPosition:Step' :: Step -> Sensitive (NonEmpty Double)
$sel:durationSeconds:Step' :: Step -> Double
$sel:distance:Step' :: Step -> Double
$sel:geometryOffset:Step' :: Step -> Maybe Natural
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
geometryOffset
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Double
distance
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Double
durationSeconds
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Sensitive (NonEmpty Double)
endPosition
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Sensitive (NonEmpty Double)
startPosition
instance Prelude.NFData Step where
rnf :: Step -> ()
rnf Step' {Double
Maybe Natural
Sensitive (NonEmpty Double)
startPosition :: Sensitive (NonEmpty Double)
endPosition :: Sensitive (NonEmpty Double)
durationSeconds :: Double
distance :: Double
geometryOffset :: Maybe Natural
$sel:startPosition:Step' :: Step -> Sensitive (NonEmpty Double)
$sel:endPosition:Step' :: Step -> Sensitive (NonEmpty Double)
$sel:durationSeconds:Step' :: Step -> Double
$sel:distance:Step' :: Step -> Double
$sel:geometryOffset:Step' :: Step -> Maybe Natural
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
geometryOffset
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Double
distance
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Double
durationSeconds
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Sensitive (NonEmpty Double)
endPosition
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Sensitive (NonEmpty Double)
startPosition