{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
{ $sel:total:TruckWeight' :: Maybe Double
total = forall a. Maybe a
Prelude.Nothing,
$sel:unit:TruckWeight' :: Maybe VehicleWeightUnit
unit = forall a. Maybe a
Prelude.Nothing
}
truckWeight_total :: Lens.Lens' TruckWeight (Prelude.Maybe Prelude.Double)
truckWeight_total :: Lens' TruckWeight (Maybe Double)
truckWeight_total = 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 :: Lens' TruckWeight (Maybe VehicleWeightUnit)
truckWeight_unit = 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 where
hashWithSalt :: Int -> TruckWeight -> Int
hashWithSalt Int
_salt TruckWeight' {Maybe Double
Maybe VehicleWeightUnit
unit :: Maybe VehicleWeightUnit
total :: Maybe Double
$sel:unit:TruckWeight' :: TruckWeight -> Maybe VehicleWeightUnit
$sel:total:TruckWeight' :: TruckWeight -> Maybe Double
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
total
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe VehicleWeightUnit
unit
instance Prelude.NFData TruckWeight where
rnf :: TruckWeight -> ()
rnf TruckWeight' {Maybe Double
Maybe VehicleWeightUnit
unit :: Maybe VehicleWeightUnit
total :: Maybe Double
$sel:unit:TruckWeight' :: TruckWeight -> Maybe VehicleWeightUnit
$sel:total:TruckWeight' :: TruckWeight -> Maybe Double
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
total seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe VehicleWeightUnit
unit
instance Data.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
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"Total" 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 Double
total,
(Key
"Unit" 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 VehicleWeightUnit
unit
]
)