{-# 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.TruckWeight where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Location.Types.VehicleWeightUnit
import qualified Amazonka.Prelude as Prelude
data TruckWeight = TruckWeight'
{
TruckWeight -> Maybe Double
total :: Prelude.Maybe Prelude.Double,
TruckWeight -> Maybe VehicleWeightUnit
unit :: Prelude.Maybe VehicleWeightUnit
}
deriving (TruckWeight -> TruckWeight -> Bool
(TruckWeight -> TruckWeight -> Bool)
-> (TruckWeight -> TruckWeight -> Bool) -> Eq TruckWeight
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TruckWeight -> TruckWeight -> Bool
$c/= :: TruckWeight -> TruckWeight -> Bool
== :: TruckWeight -> TruckWeight -> Bool
$c== :: TruckWeight -> TruckWeight -> Bool
Prelude.Eq, ReadPrec [TruckWeight]
ReadPrec TruckWeight
Int -> ReadS TruckWeight
ReadS [TruckWeight]
(Int -> ReadS TruckWeight)
-> ReadS [TruckWeight]
-> ReadPrec TruckWeight
-> ReadPrec [TruckWeight]
-> Read TruckWeight
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TruckWeight]
$creadListPrec :: ReadPrec [TruckWeight]
readPrec :: ReadPrec TruckWeight
$creadPrec :: ReadPrec TruckWeight
readList :: ReadS [TruckWeight]
$creadList :: ReadS [TruckWeight]
readsPrec :: Int -> ReadS TruckWeight
$creadsPrec :: Int -> ReadS TruckWeight
Prelude.Read, Int -> TruckWeight -> ShowS
[TruckWeight] -> ShowS
TruckWeight -> String
(Int -> TruckWeight -> ShowS)
-> (TruckWeight -> String)
-> ([TruckWeight] -> ShowS)
-> Show TruckWeight
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TruckWeight] -> ShowS
$cshowList :: [TruckWeight] -> ShowS
show :: TruckWeight -> String
$cshow :: TruckWeight -> String
showsPrec :: Int -> TruckWeight -> ShowS
$cshowsPrec :: Int -> TruckWeight -> ShowS
Prelude.Show, (forall x. TruckWeight -> Rep TruckWeight x)
-> (forall x. Rep TruckWeight x -> TruckWeight)
-> Generic TruckWeight
forall x. Rep TruckWeight x -> TruckWeight
forall x. TruckWeight -> Rep TruckWeight x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TruckWeight x -> TruckWeight
$cfrom :: forall x. TruckWeight -> Rep TruckWeight x
Prelude.Generic)
newTruckWeight ::
TruckWeight
newTruckWeight :: TruckWeight
newTruckWeight =
TruckWeight' :: Maybe Double -> Maybe VehicleWeightUnit -> TruckWeight
TruckWeight'
{ $sel:total:TruckWeight' :: Maybe Double
total = Maybe Double
forall a. Maybe a
Prelude.Nothing,
$sel:unit:TruckWeight' :: Maybe VehicleWeightUnit
unit = Maybe VehicleWeightUnit
forall a. Maybe a
Prelude.Nothing
}
truckWeight_total :: Lens.Lens' TruckWeight (Prelude.Maybe Prelude.Double)
truckWeight_total :: (Maybe Double -> f (Maybe Double)) -> TruckWeight -> f TruckWeight
truckWeight_total = (TruckWeight -> Maybe Double)
-> (TruckWeight -> Maybe Double -> TruckWeight)
-> Lens TruckWeight TruckWeight (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TruckWeight' {Maybe Double
total :: Maybe Double
$sel:total:TruckWeight' :: TruckWeight -> Maybe Double
total} -> Maybe Double
total) (\s :: TruckWeight
s@TruckWeight' {} Maybe Double
a -> TruckWeight
s {$sel:total:TruckWeight' :: Maybe Double
total = Maybe Double
a} :: TruckWeight)
truckWeight_unit :: Lens.Lens' TruckWeight (Prelude.Maybe VehicleWeightUnit)
truckWeight_unit :: (Maybe VehicleWeightUnit -> f (Maybe VehicleWeightUnit))
-> TruckWeight -> f TruckWeight
truckWeight_unit = (TruckWeight -> Maybe VehicleWeightUnit)
-> (TruckWeight -> Maybe VehicleWeightUnit -> TruckWeight)
-> Lens
TruckWeight
TruckWeight
(Maybe VehicleWeightUnit)
(Maybe VehicleWeightUnit)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TruckWeight' {Maybe VehicleWeightUnit
unit :: Maybe VehicleWeightUnit
$sel:unit:TruckWeight' :: TruckWeight -> Maybe VehicleWeightUnit
unit} -> Maybe VehicleWeightUnit
unit) (\s :: TruckWeight
s@TruckWeight' {} Maybe VehicleWeightUnit
a -> TruckWeight
s {$sel:unit:TruckWeight' :: Maybe VehicleWeightUnit
unit = Maybe VehicleWeightUnit
a} :: TruckWeight)
instance Prelude.Hashable TruckWeight
instance Prelude.NFData TruckWeight
instance Core.ToJSON TruckWeight where
toJSON :: TruckWeight -> Value
toJSON TruckWeight' {Maybe Double
Maybe VehicleWeightUnit
unit :: Maybe VehicleWeightUnit
total :: Maybe Double
$sel:unit:TruckWeight' :: TruckWeight -> Maybe VehicleWeightUnit
$sel:total:TruckWeight' :: TruckWeight -> Maybe Double
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Total" Text -> Double -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Double -> Pair) -> Maybe Double -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Double
total,
(Text
"Unit" Text -> VehicleWeightUnit -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (VehicleWeightUnit -> Pair)
-> Maybe VehicleWeightUnit -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe VehicleWeightUnit
unit
]
)