{-# 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.CalculateRouteMatrixSummary
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Location.Types.CalculateRouteMatrixSummary 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.DistanceUnit
import qualified Amazonka.Prelude as Prelude

-- | A summary of the calculated route matrix.
--
-- /See:/ 'newCalculateRouteMatrixSummary' smart constructor.
data CalculateRouteMatrixSummary = CalculateRouteMatrixSummary'
  { -- | The data provider of traffic and road network data used to calculate the
    -- routes. Indicates one of the available providers:
    --
    -- -   @Esri@
    --
    -- -   @Here@
    --
    -- For more information about data providers, see
    -- <https://docs.aws.amazon.com/location/latest/developerguide/what-is-data-provider.html Amazon Location Service data providers>.
    CalculateRouteMatrixSummary -> Text
dataSource :: Prelude.Text,
    -- | The unit of measurement for route distances.
    CalculateRouteMatrixSummary -> DistanceUnit
distanceUnit :: DistanceUnit,
    -- | The count of error results in the route matrix. If this number is 0, all
    -- routes were calculated successfully.
    CalculateRouteMatrixSummary -> Natural
errorCount :: Prelude.Natural,
    -- | The count of cells in the route matrix. Equal to the number of
    -- @DeparturePositions@ multiplied by the number of @DestinationPositions@.
    CalculateRouteMatrixSummary -> Natural
routeCount :: Prelude.Natural
  }
  deriving (CalculateRouteMatrixSummary -> CalculateRouteMatrixSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CalculateRouteMatrixSummary -> CalculateRouteMatrixSummary -> Bool
$c/= :: CalculateRouteMatrixSummary -> CalculateRouteMatrixSummary -> Bool
== :: CalculateRouteMatrixSummary -> CalculateRouteMatrixSummary -> Bool
$c== :: CalculateRouteMatrixSummary -> CalculateRouteMatrixSummary -> Bool
Prelude.Eq, ReadPrec [CalculateRouteMatrixSummary]
ReadPrec CalculateRouteMatrixSummary
Int -> ReadS CalculateRouteMatrixSummary
ReadS [CalculateRouteMatrixSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CalculateRouteMatrixSummary]
$creadListPrec :: ReadPrec [CalculateRouteMatrixSummary]
readPrec :: ReadPrec CalculateRouteMatrixSummary
$creadPrec :: ReadPrec CalculateRouteMatrixSummary
readList :: ReadS [CalculateRouteMatrixSummary]
$creadList :: ReadS [CalculateRouteMatrixSummary]
readsPrec :: Int -> ReadS CalculateRouteMatrixSummary
$creadsPrec :: Int -> ReadS CalculateRouteMatrixSummary
Prelude.Read, Int -> CalculateRouteMatrixSummary -> ShowS
[CalculateRouteMatrixSummary] -> ShowS
CalculateRouteMatrixSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CalculateRouteMatrixSummary] -> ShowS
$cshowList :: [CalculateRouteMatrixSummary] -> ShowS
show :: CalculateRouteMatrixSummary -> String
$cshow :: CalculateRouteMatrixSummary -> String
showsPrec :: Int -> CalculateRouteMatrixSummary -> ShowS
$cshowsPrec :: Int -> CalculateRouteMatrixSummary -> ShowS
Prelude.Show, forall x.
Rep CalculateRouteMatrixSummary x -> CalculateRouteMatrixSummary
forall x.
CalculateRouteMatrixSummary -> Rep CalculateRouteMatrixSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CalculateRouteMatrixSummary x -> CalculateRouteMatrixSummary
$cfrom :: forall x.
CalculateRouteMatrixSummary -> Rep CalculateRouteMatrixSummary x
Prelude.Generic)

-- |
-- Create a value of 'CalculateRouteMatrixSummary' 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:
--
-- 'dataSource', 'calculateRouteMatrixSummary_dataSource' - The data provider of traffic and road network data used to calculate the
-- routes. Indicates one of the available providers:
--
-- -   @Esri@
--
-- -   @Here@
--
-- For more information about data providers, see
-- <https://docs.aws.amazon.com/location/latest/developerguide/what-is-data-provider.html Amazon Location Service data providers>.
--
-- 'distanceUnit', 'calculateRouteMatrixSummary_distanceUnit' - The unit of measurement for route distances.
--
-- 'errorCount', 'calculateRouteMatrixSummary_errorCount' - The count of error results in the route matrix. If this number is 0, all
-- routes were calculated successfully.
--
-- 'routeCount', 'calculateRouteMatrixSummary_routeCount' - The count of cells in the route matrix. Equal to the number of
-- @DeparturePositions@ multiplied by the number of @DestinationPositions@.
newCalculateRouteMatrixSummary ::
  -- | 'dataSource'
  Prelude.Text ->
  -- | 'distanceUnit'
  DistanceUnit ->
  -- | 'errorCount'
  Prelude.Natural ->
  -- | 'routeCount'
  Prelude.Natural ->
  CalculateRouteMatrixSummary
newCalculateRouteMatrixSummary :: Text
-> DistanceUnit
-> Natural
-> Natural
-> CalculateRouteMatrixSummary
newCalculateRouteMatrixSummary
  Text
pDataSource_
  DistanceUnit
pDistanceUnit_
  Natural
pErrorCount_
  Natural
pRouteCount_ =
    CalculateRouteMatrixSummary'
      { $sel:dataSource:CalculateRouteMatrixSummary' :: Text
dataSource =
          Text
pDataSource_,
        $sel:distanceUnit:CalculateRouteMatrixSummary' :: DistanceUnit
distanceUnit = DistanceUnit
pDistanceUnit_,
        $sel:errorCount:CalculateRouteMatrixSummary' :: Natural
errorCount = Natural
pErrorCount_,
        $sel:routeCount:CalculateRouteMatrixSummary' :: Natural
routeCount = Natural
pRouteCount_
      }

-- | The data provider of traffic and road network data used to calculate the
-- routes. Indicates one of the available providers:
--
-- -   @Esri@
--
-- -   @Here@
--
-- For more information about data providers, see
-- <https://docs.aws.amazon.com/location/latest/developerguide/what-is-data-provider.html Amazon Location Service data providers>.
calculateRouteMatrixSummary_dataSource :: Lens.Lens' CalculateRouteMatrixSummary Prelude.Text
calculateRouteMatrixSummary_dataSource :: Lens' CalculateRouteMatrixSummary Text
calculateRouteMatrixSummary_dataSource = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CalculateRouteMatrixSummary' {Text
dataSource :: Text
$sel:dataSource:CalculateRouteMatrixSummary' :: CalculateRouteMatrixSummary -> Text
dataSource} -> Text
dataSource) (\s :: CalculateRouteMatrixSummary
s@CalculateRouteMatrixSummary' {} Text
a -> CalculateRouteMatrixSummary
s {$sel:dataSource:CalculateRouteMatrixSummary' :: Text
dataSource = Text
a} :: CalculateRouteMatrixSummary)

-- | The unit of measurement for route distances.
calculateRouteMatrixSummary_distanceUnit :: Lens.Lens' CalculateRouteMatrixSummary DistanceUnit
calculateRouteMatrixSummary_distanceUnit :: Lens' CalculateRouteMatrixSummary DistanceUnit
calculateRouteMatrixSummary_distanceUnit = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CalculateRouteMatrixSummary' {DistanceUnit
distanceUnit :: DistanceUnit
$sel:distanceUnit:CalculateRouteMatrixSummary' :: CalculateRouteMatrixSummary -> DistanceUnit
distanceUnit} -> DistanceUnit
distanceUnit) (\s :: CalculateRouteMatrixSummary
s@CalculateRouteMatrixSummary' {} DistanceUnit
a -> CalculateRouteMatrixSummary
s {$sel:distanceUnit:CalculateRouteMatrixSummary' :: DistanceUnit
distanceUnit = DistanceUnit
a} :: CalculateRouteMatrixSummary)

-- | The count of error results in the route matrix. If this number is 0, all
-- routes were calculated successfully.
calculateRouteMatrixSummary_errorCount :: Lens.Lens' CalculateRouteMatrixSummary Prelude.Natural
calculateRouteMatrixSummary_errorCount :: Lens' CalculateRouteMatrixSummary Natural
calculateRouteMatrixSummary_errorCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CalculateRouteMatrixSummary' {Natural
errorCount :: Natural
$sel:errorCount:CalculateRouteMatrixSummary' :: CalculateRouteMatrixSummary -> Natural
errorCount} -> Natural
errorCount) (\s :: CalculateRouteMatrixSummary
s@CalculateRouteMatrixSummary' {} Natural
a -> CalculateRouteMatrixSummary
s {$sel:errorCount:CalculateRouteMatrixSummary' :: Natural
errorCount = Natural
a} :: CalculateRouteMatrixSummary)

-- | The count of cells in the route matrix. Equal to the number of
-- @DeparturePositions@ multiplied by the number of @DestinationPositions@.
calculateRouteMatrixSummary_routeCount :: Lens.Lens' CalculateRouteMatrixSummary Prelude.Natural
calculateRouteMatrixSummary_routeCount :: Lens' CalculateRouteMatrixSummary Natural
calculateRouteMatrixSummary_routeCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CalculateRouteMatrixSummary' {Natural
routeCount :: Natural
$sel:routeCount:CalculateRouteMatrixSummary' :: CalculateRouteMatrixSummary -> Natural
routeCount} -> Natural
routeCount) (\s :: CalculateRouteMatrixSummary
s@CalculateRouteMatrixSummary' {} Natural
a -> CalculateRouteMatrixSummary
s {$sel:routeCount:CalculateRouteMatrixSummary' :: Natural
routeCount = Natural
a} :: CalculateRouteMatrixSummary)

instance Data.FromJSON CalculateRouteMatrixSummary where
  parseJSON :: Value -> Parser CalculateRouteMatrixSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"CalculateRouteMatrixSummary"
      ( \Object
x ->
          Text
-> DistanceUnit
-> Natural
-> Natural
-> CalculateRouteMatrixSummary
CalculateRouteMatrixSummary'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"DataSource")
            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
"DistanceUnit")
            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
"ErrorCount")
            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
"RouteCount")
      )

instance Prelude.Hashable CalculateRouteMatrixSummary where
  hashWithSalt :: Int -> CalculateRouteMatrixSummary -> Int
hashWithSalt Int
_salt CalculateRouteMatrixSummary' {Natural
Text
DistanceUnit
routeCount :: Natural
errorCount :: Natural
distanceUnit :: DistanceUnit
dataSource :: Text
$sel:routeCount:CalculateRouteMatrixSummary' :: CalculateRouteMatrixSummary -> Natural
$sel:errorCount:CalculateRouteMatrixSummary' :: CalculateRouteMatrixSummary -> Natural
$sel:distanceUnit:CalculateRouteMatrixSummary' :: CalculateRouteMatrixSummary -> DistanceUnit
$sel:dataSource:CalculateRouteMatrixSummary' :: CalculateRouteMatrixSummary -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
dataSource
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` DistanceUnit
distanceUnit
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
errorCount
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
routeCount

instance Prelude.NFData CalculateRouteMatrixSummary where
  rnf :: CalculateRouteMatrixSummary -> ()
rnf CalculateRouteMatrixSummary' {Natural
Text
DistanceUnit
routeCount :: Natural
errorCount :: Natural
distanceUnit :: DistanceUnit
dataSource :: Text
$sel:routeCount:CalculateRouteMatrixSummary' :: CalculateRouteMatrixSummary -> Natural
$sel:errorCount:CalculateRouteMatrixSummary' :: CalculateRouteMatrixSummary -> Natural
$sel:distanceUnit:CalculateRouteMatrixSummary' :: CalculateRouteMatrixSummary -> DistanceUnit
$sel:dataSource:CalculateRouteMatrixSummary' :: CalculateRouteMatrixSummary -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
dataSource
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf DistanceUnit
distanceUnit
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Natural
errorCount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Natural
routeCount