{-# 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.TruckDimensions
-- 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.TruckDimensions where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Location.Types.DimensionUnit
import qualified Amazonka.Prelude as Prelude

-- | Contains details about the truck dimensions in the unit of measurement
-- that you specify. Used to filter out roads that can\'t support or allow
-- the specified dimensions for requests that specify @TravelMode@ as
-- @Truck@.
--
-- /See:/ 'newTruckDimensions' smart constructor.
data TruckDimensions = TruckDimensions'
  { -- | The length of the truck.
    --
    -- -   For example, @15.5@.
    TruckDimensions -> Maybe Double
length :: Prelude.Maybe Prelude.Double,
    -- | The height of the truck.
    --
    -- -   For example, @4.5@.
    TruckDimensions -> Maybe Double
height :: Prelude.Maybe Prelude.Double,
    -- | The width of the truck.
    --
    -- -   For example, @4.5@.
    TruckDimensions -> Maybe Double
width :: Prelude.Maybe Prelude.Double,
    -- | Specifies the unit of measurement for the truck dimensions.
    --
    -- Default Value: @Meters@
    TruckDimensions -> Maybe DimensionUnit
unit :: Prelude.Maybe DimensionUnit
  }
  deriving (TruckDimensions -> TruckDimensions -> Bool
(TruckDimensions -> TruckDimensions -> Bool)
-> (TruckDimensions -> TruckDimensions -> Bool)
-> Eq TruckDimensions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TruckDimensions -> TruckDimensions -> Bool
$c/= :: TruckDimensions -> TruckDimensions -> Bool
== :: TruckDimensions -> TruckDimensions -> Bool
$c== :: TruckDimensions -> TruckDimensions -> Bool
Prelude.Eq, ReadPrec [TruckDimensions]
ReadPrec TruckDimensions
Int -> ReadS TruckDimensions
ReadS [TruckDimensions]
(Int -> ReadS TruckDimensions)
-> ReadS [TruckDimensions]
-> ReadPrec TruckDimensions
-> ReadPrec [TruckDimensions]
-> Read TruckDimensions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TruckDimensions]
$creadListPrec :: ReadPrec [TruckDimensions]
readPrec :: ReadPrec TruckDimensions
$creadPrec :: ReadPrec TruckDimensions
readList :: ReadS [TruckDimensions]
$creadList :: ReadS [TruckDimensions]
readsPrec :: Int -> ReadS TruckDimensions
$creadsPrec :: Int -> ReadS TruckDimensions
Prelude.Read, Int -> TruckDimensions -> ShowS
[TruckDimensions] -> ShowS
TruckDimensions -> String
(Int -> TruckDimensions -> ShowS)
-> (TruckDimensions -> String)
-> ([TruckDimensions] -> ShowS)
-> Show TruckDimensions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TruckDimensions] -> ShowS
$cshowList :: [TruckDimensions] -> ShowS
show :: TruckDimensions -> String
$cshow :: TruckDimensions -> String
showsPrec :: Int -> TruckDimensions -> ShowS
$cshowsPrec :: Int -> TruckDimensions -> ShowS
Prelude.Show, (forall x. TruckDimensions -> Rep TruckDimensions x)
-> (forall x. Rep TruckDimensions x -> TruckDimensions)
-> Generic TruckDimensions
forall x. Rep TruckDimensions x -> TruckDimensions
forall x. TruckDimensions -> Rep TruckDimensions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TruckDimensions x -> TruckDimensions
$cfrom :: forall x. TruckDimensions -> Rep TruckDimensions x
Prelude.Generic)

-- |
-- Create a value of 'TruckDimensions' 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:
--
-- 'length', 'truckDimensions_length' - The length of the truck.
--
-- -   For example, @15.5@.
--
-- 'height', 'truckDimensions_height' - The height of the truck.
--
-- -   For example, @4.5@.
--
-- 'width', 'truckDimensions_width' - The width of the truck.
--
-- -   For example, @4.5@.
--
-- 'unit', 'truckDimensions_unit' - Specifies the unit of measurement for the truck dimensions.
--
-- Default Value: @Meters@
newTruckDimensions ::
  TruckDimensions
newTruckDimensions :: TruckDimensions
newTruckDimensions =
  TruckDimensions' :: Maybe Double
-> Maybe Double
-> Maybe Double
-> Maybe DimensionUnit
-> TruckDimensions
TruckDimensions'
    { $sel:length:TruckDimensions' :: Maybe Double
length = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:height:TruckDimensions' :: Maybe Double
height = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:width:TruckDimensions' :: Maybe Double
width = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:unit:TruckDimensions' :: Maybe DimensionUnit
unit = Maybe DimensionUnit
forall a. Maybe a
Prelude.Nothing
    }

-- | The length of the truck.
--
-- -   For example, @15.5@.
truckDimensions_length :: Lens.Lens' TruckDimensions (Prelude.Maybe Prelude.Double)
truckDimensions_length :: (Maybe Double -> f (Maybe Double))
-> TruckDimensions -> f TruckDimensions
truckDimensions_length = (TruckDimensions -> Maybe Double)
-> (TruckDimensions -> Maybe Double -> TruckDimensions)
-> Lens
     TruckDimensions TruckDimensions (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TruckDimensions' {Maybe Double
length :: Maybe Double
$sel:length:TruckDimensions' :: TruckDimensions -> Maybe Double
length} -> Maybe Double
length) (\s :: TruckDimensions
s@TruckDimensions' {} Maybe Double
a -> TruckDimensions
s {$sel:length:TruckDimensions' :: Maybe Double
length = Maybe Double
a} :: TruckDimensions)

-- | The height of the truck.
--
-- -   For example, @4.5@.
truckDimensions_height :: Lens.Lens' TruckDimensions (Prelude.Maybe Prelude.Double)
truckDimensions_height :: (Maybe Double -> f (Maybe Double))
-> TruckDimensions -> f TruckDimensions
truckDimensions_height = (TruckDimensions -> Maybe Double)
-> (TruckDimensions -> Maybe Double -> TruckDimensions)
-> Lens
     TruckDimensions TruckDimensions (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TruckDimensions' {Maybe Double
height :: Maybe Double
$sel:height:TruckDimensions' :: TruckDimensions -> Maybe Double
height} -> Maybe Double
height) (\s :: TruckDimensions
s@TruckDimensions' {} Maybe Double
a -> TruckDimensions
s {$sel:height:TruckDimensions' :: Maybe Double
height = Maybe Double
a} :: TruckDimensions)

-- | The width of the truck.
--
-- -   For example, @4.5@.
truckDimensions_width :: Lens.Lens' TruckDimensions (Prelude.Maybe Prelude.Double)
truckDimensions_width :: (Maybe Double -> f (Maybe Double))
-> TruckDimensions -> f TruckDimensions
truckDimensions_width = (TruckDimensions -> Maybe Double)
-> (TruckDimensions -> Maybe Double -> TruckDimensions)
-> Lens
     TruckDimensions TruckDimensions (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TruckDimensions' {Maybe Double
width :: Maybe Double
$sel:width:TruckDimensions' :: TruckDimensions -> Maybe Double
width} -> Maybe Double
width) (\s :: TruckDimensions
s@TruckDimensions' {} Maybe Double
a -> TruckDimensions
s {$sel:width:TruckDimensions' :: Maybe Double
width = Maybe Double
a} :: TruckDimensions)

-- | Specifies the unit of measurement for the truck dimensions.
--
-- Default Value: @Meters@
truckDimensions_unit :: Lens.Lens' TruckDimensions (Prelude.Maybe DimensionUnit)
truckDimensions_unit :: (Maybe DimensionUnit -> f (Maybe DimensionUnit))
-> TruckDimensions -> f TruckDimensions
truckDimensions_unit = (TruckDimensions -> Maybe DimensionUnit)
-> (TruckDimensions -> Maybe DimensionUnit -> TruckDimensions)
-> Lens
     TruckDimensions
     TruckDimensions
     (Maybe DimensionUnit)
     (Maybe DimensionUnit)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TruckDimensions' {Maybe DimensionUnit
unit :: Maybe DimensionUnit
$sel:unit:TruckDimensions' :: TruckDimensions -> Maybe DimensionUnit
unit} -> Maybe DimensionUnit
unit) (\s :: TruckDimensions
s@TruckDimensions' {} Maybe DimensionUnit
a -> TruckDimensions
s {$sel:unit:TruckDimensions' :: Maybe DimensionUnit
unit = Maybe DimensionUnit
a} :: TruckDimensions)

instance Prelude.Hashable TruckDimensions

instance Prelude.NFData TruckDimensions

instance Core.ToJSON TruckDimensions where
  toJSON :: TruckDimensions -> Value
toJSON TruckDimensions' {Maybe Double
Maybe DimensionUnit
unit :: Maybe DimensionUnit
width :: Maybe Double
height :: Maybe Double
length :: Maybe Double
$sel:unit:TruckDimensions' :: TruckDimensions -> Maybe DimensionUnit
$sel:width:TruckDimensions' :: TruckDimensions -> Maybe Double
$sel:height:TruckDimensions' :: TruckDimensions -> Maybe Double
$sel:length:TruckDimensions' :: TruckDimensions -> Maybe Double
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Length" 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
length,
            (Text
"Height" 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
height,
            (Text
"Width" 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
width,
            (Text
"Unit" Text -> DimensionUnit -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (DimensionUnit -> Pair) -> Maybe DimensionUnit -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DimensionUnit
unit
          ]
      )