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

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

-- | Contains details about additional route preferences for requests that
-- specify @TravelMode@ as @Car@.
--
-- /See:/ 'newCalculateRouteCarModeOptions' smart constructor.
data CalculateRouteCarModeOptions = CalculateRouteCarModeOptions'
  { -- | Avoids tolls when calculating routes.
    --
    -- Default Value: @false@
    --
    -- Valid Values: @false@ | @true@
    CalculateRouteCarModeOptions -> Maybe Bool
avoidTolls :: Prelude.Maybe Prelude.Bool,
    -- | Avoids ferries when calculating routes.
    --
    -- Default Value: @false@
    --
    -- Valid Values: @false@ | @true@
    CalculateRouteCarModeOptions -> Maybe Bool
avoidFerries :: Prelude.Maybe Prelude.Bool
  }
  deriving (CalculateRouteCarModeOptions
-> CalculateRouteCarModeOptions -> Bool
(CalculateRouteCarModeOptions
 -> CalculateRouteCarModeOptions -> Bool)
-> (CalculateRouteCarModeOptions
    -> CalculateRouteCarModeOptions -> Bool)
-> Eq CalculateRouteCarModeOptions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CalculateRouteCarModeOptions
-> CalculateRouteCarModeOptions -> Bool
$c/= :: CalculateRouteCarModeOptions
-> CalculateRouteCarModeOptions -> Bool
== :: CalculateRouteCarModeOptions
-> CalculateRouteCarModeOptions -> Bool
$c== :: CalculateRouteCarModeOptions
-> CalculateRouteCarModeOptions -> Bool
Prelude.Eq, ReadPrec [CalculateRouteCarModeOptions]
ReadPrec CalculateRouteCarModeOptions
Int -> ReadS CalculateRouteCarModeOptions
ReadS [CalculateRouteCarModeOptions]
(Int -> ReadS CalculateRouteCarModeOptions)
-> ReadS [CalculateRouteCarModeOptions]
-> ReadPrec CalculateRouteCarModeOptions
-> ReadPrec [CalculateRouteCarModeOptions]
-> Read CalculateRouteCarModeOptions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CalculateRouteCarModeOptions]
$creadListPrec :: ReadPrec [CalculateRouteCarModeOptions]
readPrec :: ReadPrec CalculateRouteCarModeOptions
$creadPrec :: ReadPrec CalculateRouteCarModeOptions
readList :: ReadS [CalculateRouteCarModeOptions]
$creadList :: ReadS [CalculateRouteCarModeOptions]
readsPrec :: Int -> ReadS CalculateRouteCarModeOptions
$creadsPrec :: Int -> ReadS CalculateRouteCarModeOptions
Prelude.Read, Int -> CalculateRouteCarModeOptions -> ShowS
[CalculateRouteCarModeOptions] -> ShowS
CalculateRouteCarModeOptions -> String
(Int -> CalculateRouteCarModeOptions -> ShowS)
-> (CalculateRouteCarModeOptions -> String)
-> ([CalculateRouteCarModeOptions] -> ShowS)
-> Show CalculateRouteCarModeOptions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CalculateRouteCarModeOptions] -> ShowS
$cshowList :: [CalculateRouteCarModeOptions] -> ShowS
show :: CalculateRouteCarModeOptions -> String
$cshow :: CalculateRouteCarModeOptions -> String
showsPrec :: Int -> CalculateRouteCarModeOptions -> ShowS
$cshowsPrec :: Int -> CalculateRouteCarModeOptions -> ShowS
Prelude.Show, (forall x.
 CalculateRouteCarModeOptions -> Rep CalculateRouteCarModeOptions x)
-> (forall x.
    Rep CalculateRouteCarModeOptions x -> CalculateRouteCarModeOptions)
-> Generic CalculateRouteCarModeOptions
forall x.
Rep CalculateRouteCarModeOptions x -> CalculateRouteCarModeOptions
forall x.
CalculateRouteCarModeOptions -> Rep CalculateRouteCarModeOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CalculateRouteCarModeOptions x -> CalculateRouteCarModeOptions
$cfrom :: forall x.
CalculateRouteCarModeOptions -> Rep CalculateRouteCarModeOptions x
Prelude.Generic)

-- |
-- Create a value of 'CalculateRouteCarModeOptions' 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:
--
-- 'avoidTolls', 'calculateRouteCarModeOptions_avoidTolls' - Avoids tolls when calculating routes.
--
-- Default Value: @false@
--
-- Valid Values: @false@ | @true@
--
-- 'avoidFerries', 'calculateRouteCarModeOptions_avoidFerries' - Avoids ferries when calculating routes.
--
-- Default Value: @false@
--
-- Valid Values: @false@ | @true@
newCalculateRouteCarModeOptions ::
  CalculateRouteCarModeOptions
newCalculateRouteCarModeOptions :: CalculateRouteCarModeOptions
newCalculateRouteCarModeOptions =
  CalculateRouteCarModeOptions' :: Maybe Bool -> Maybe Bool -> CalculateRouteCarModeOptions
CalculateRouteCarModeOptions'
    { $sel:avoidTolls:CalculateRouteCarModeOptions' :: Maybe Bool
avoidTolls =
        Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:avoidFerries:CalculateRouteCarModeOptions' :: Maybe Bool
avoidFerries = Maybe Bool
forall a. Maybe a
Prelude.Nothing
    }

-- | Avoids tolls when calculating routes.
--
-- Default Value: @false@
--
-- Valid Values: @false@ | @true@
calculateRouteCarModeOptions_avoidTolls :: Lens.Lens' CalculateRouteCarModeOptions (Prelude.Maybe Prelude.Bool)
calculateRouteCarModeOptions_avoidTolls :: (Maybe Bool -> f (Maybe Bool))
-> CalculateRouteCarModeOptions -> f CalculateRouteCarModeOptions
calculateRouteCarModeOptions_avoidTolls = (CalculateRouteCarModeOptions -> Maybe Bool)
-> (CalculateRouteCarModeOptions
    -> Maybe Bool -> CalculateRouteCarModeOptions)
-> Lens
     CalculateRouteCarModeOptions
     CalculateRouteCarModeOptions
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CalculateRouteCarModeOptions' {Maybe Bool
avoidTolls :: Maybe Bool
$sel:avoidTolls:CalculateRouteCarModeOptions' :: CalculateRouteCarModeOptions -> Maybe Bool
avoidTolls} -> Maybe Bool
avoidTolls) (\s :: CalculateRouteCarModeOptions
s@CalculateRouteCarModeOptions' {} Maybe Bool
a -> CalculateRouteCarModeOptions
s {$sel:avoidTolls:CalculateRouteCarModeOptions' :: Maybe Bool
avoidTolls = Maybe Bool
a} :: CalculateRouteCarModeOptions)

-- | Avoids ferries when calculating routes.
--
-- Default Value: @false@
--
-- Valid Values: @false@ | @true@
calculateRouteCarModeOptions_avoidFerries :: Lens.Lens' CalculateRouteCarModeOptions (Prelude.Maybe Prelude.Bool)
calculateRouteCarModeOptions_avoidFerries :: (Maybe Bool -> f (Maybe Bool))
-> CalculateRouteCarModeOptions -> f CalculateRouteCarModeOptions
calculateRouteCarModeOptions_avoidFerries = (CalculateRouteCarModeOptions -> Maybe Bool)
-> (CalculateRouteCarModeOptions
    -> Maybe Bool -> CalculateRouteCarModeOptions)
-> Lens
     CalculateRouteCarModeOptions
     CalculateRouteCarModeOptions
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CalculateRouteCarModeOptions' {Maybe Bool
avoidFerries :: Maybe Bool
$sel:avoidFerries:CalculateRouteCarModeOptions' :: CalculateRouteCarModeOptions -> Maybe Bool
avoidFerries} -> Maybe Bool
avoidFerries) (\s :: CalculateRouteCarModeOptions
s@CalculateRouteCarModeOptions' {} Maybe Bool
a -> CalculateRouteCarModeOptions
s {$sel:avoidFerries:CalculateRouteCarModeOptions' :: Maybe Bool
avoidFerries = Maybe Bool
a} :: CalculateRouteCarModeOptions)

instance
  Prelude.Hashable
    CalculateRouteCarModeOptions

instance Prelude.NFData CalculateRouteCarModeOptions

instance Core.ToJSON CalculateRouteCarModeOptions where
  toJSON :: CalculateRouteCarModeOptions -> Value
toJSON CalculateRouteCarModeOptions' {Maybe Bool
avoidFerries :: Maybe Bool
avoidTolls :: Maybe Bool
$sel:avoidFerries:CalculateRouteCarModeOptions' :: CalculateRouteCarModeOptions -> Maybe Bool
$sel:avoidTolls:CalculateRouteCarModeOptions' :: CalculateRouteCarModeOptions -> Maybe Bool
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"AvoidTolls" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
avoidTolls,
            (Text
"AvoidFerries" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
avoidFerries
          ]
      )