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

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

-- | A summary of the reverse geocoding request sent using
-- @SearchPlaceIndexForPosition@.
--
-- /See:/ 'newSearchPlaceIndexForPositionSummary' smart constructor.
data SearchPlaceIndexForPositionSummary = SearchPlaceIndexForPositionSummary'
  { -- | An optional parameter. The maximum number of results returned per
    -- request.
    --
    -- Default value: @50@
    SearchPlaceIndexForPositionSummary -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The data provider of geospatial data. Indicates one of the available
    -- providers:
    --
    -- -   Esri
    --
    -- -   HERE
    --
    -- For additional details on data providers, see
    -- <https://docs.aws.amazon.com/location/latest/developerguide/what-is-data-provider.html Amazon Location Service data providers>.
    SearchPlaceIndexForPositionSummary -> Text
dataSource :: Prelude.Text,
    -- | The position given in the reverse geocoding request.
    SearchPlaceIndexForPositionSummary -> Sensitive (NonEmpty Double)
position :: Core.Sensitive (Prelude.NonEmpty Prelude.Double)
  }
  deriving (SearchPlaceIndexForPositionSummary
-> SearchPlaceIndexForPositionSummary -> Bool
(SearchPlaceIndexForPositionSummary
 -> SearchPlaceIndexForPositionSummary -> Bool)
-> (SearchPlaceIndexForPositionSummary
    -> SearchPlaceIndexForPositionSummary -> Bool)
-> Eq SearchPlaceIndexForPositionSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SearchPlaceIndexForPositionSummary
-> SearchPlaceIndexForPositionSummary -> Bool
$c/= :: SearchPlaceIndexForPositionSummary
-> SearchPlaceIndexForPositionSummary -> Bool
== :: SearchPlaceIndexForPositionSummary
-> SearchPlaceIndexForPositionSummary -> Bool
$c== :: SearchPlaceIndexForPositionSummary
-> SearchPlaceIndexForPositionSummary -> Bool
Prelude.Eq, Int -> SearchPlaceIndexForPositionSummary -> ShowS
[SearchPlaceIndexForPositionSummary] -> ShowS
SearchPlaceIndexForPositionSummary -> String
(Int -> SearchPlaceIndexForPositionSummary -> ShowS)
-> (SearchPlaceIndexForPositionSummary -> String)
-> ([SearchPlaceIndexForPositionSummary] -> ShowS)
-> Show SearchPlaceIndexForPositionSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SearchPlaceIndexForPositionSummary] -> ShowS
$cshowList :: [SearchPlaceIndexForPositionSummary] -> ShowS
show :: SearchPlaceIndexForPositionSummary -> String
$cshow :: SearchPlaceIndexForPositionSummary -> String
showsPrec :: Int -> SearchPlaceIndexForPositionSummary -> ShowS
$cshowsPrec :: Int -> SearchPlaceIndexForPositionSummary -> ShowS
Prelude.Show, (forall x.
 SearchPlaceIndexForPositionSummary
 -> Rep SearchPlaceIndexForPositionSummary x)
-> (forall x.
    Rep SearchPlaceIndexForPositionSummary x
    -> SearchPlaceIndexForPositionSummary)
-> Generic SearchPlaceIndexForPositionSummary
forall x.
Rep SearchPlaceIndexForPositionSummary x
-> SearchPlaceIndexForPositionSummary
forall x.
SearchPlaceIndexForPositionSummary
-> Rep SearchPlaceIndexForPositionSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SearchPlaceIndexForPositionSummary x
-> SearchPlaceIndexForPositionSummary
$cfrom :: forall x.
SearchPlaceIndexForPositionSummary
-> Rep SearchPlaceIndexForPositionSummary x
Prelude.Generic)

-- |
-- Create a value of 'SearchPlaceIndexForPositionSummary' 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:
--
-- 'maxResults', 'searchPlaceIndexForPositionSummary_maxResults' - An optional parameter. The maximum number of results returned per
-- request.
--
-- Default value: @50@
--
-- 'dataSource', 'searchPlaceIndexForPositionSummary_dataSource' - The data provider of geospatial data. Indicates one of the available
-- providers:
--
-- -   Esri
--
-- -   HERE
--
-- For additional details on data providers, see
-- <https://docs.aws.amazon.com/location/latest/developerguide/what-is-data-provider.html Amazon Location Service data providers>.
--
-- 'position', 'searchPlaceIndexForPositionSummary_position' - The position given in the reverse geocoding request.
newSearchPlaceIndexForPositionSummary ::
  -- | 'dataSource'
  Prelude.Text ->
  -- | 'position'
  Prelude.NonEmpty Prelude.Double ->
  SearchPlaceIndexForPositionSummary
newSearchPlaceIndexForPositionSummary :: Text -> NonEmpty Double -> SearchPlaceIndexForPositionSummary
newSearchPlaceIndexForPositionSummary
  Text
pDataSource_
  NonEmpty Double
pPosition_ =
    SearchPlaceIndexForPositionSummary' :: Maybe Natural
-> Text
-> Sensitive (NonEmpty Double)
-> SearchPlaceIndexForPositionSummary
SearchPlaceIndexForPositionSummary'
      { $sel:maxResults:SearchPlaceIndexForPositionSummary' :: Maybe Natural
maxResults =
          Maybe Natural
forall a. Maybe a
Prelude.Nothing,
        $sel:dataSource:SearchPlaceIndexForPositionSummary' :: Text
dataSource = Text
pDataSource_,
        $sel:position:SearchPlaceIndexForPositionSummary' :: Sensitive (NonEmpty Double)
position =
          Tagged (NonEmpty Double) (Identity (NonEmpty Double))
-> Tagged
     (Sensitive (NonEmpty Double))
     (Identity (Sensitive (NonEmpty Double)))
forall a. Iso' (Sensitive a) a
Core._Sensitive (Tagged (NonEmpty Double) (Identity (NonEmpty Double))
 -> Tagged
      (Sensitive (NonEmpty Double))
      (Identity (Sensitive (NonEmpty Double))))
-> (Tagged (NonEmpty Double) (Identity (NonEmpty Double))
    -> Tagged (NonEmpty Double) (Identity (NonEmpty Double)))
-> Tagged (NonEmpty Double) (Identity (NonEmpty Double))
-> Tagged
     (Sensitive (NonEmpty Double))
     (Identity (Sensitive (NonEmpty Double)))
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Tagged (NonEmpty Double) (Identity (NonEmpty Double))
-> Tagged (NonEmpty Double) (Identity (NonEmpty Double))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
            (Tagged (NonEmpty Double) (Identity (NonEmpty Double))
 -> Tagged
      (Sensitive (NonEmpty Double))
      (Identity (Sensitive (NonEmpty Double))))
-> NonEmpty Double -> Sensitive (NonEmpty Double)
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Double
pPosition_
      }

-- | An optional parameter. The maximum number of results returned per
-- request.
--
-- Default value: @50@
searchPlaceIndexForPositionSummary_maxResults :: Lens.Lens' SearchPlaceIndexForPositionSummary (Prelude.Maybe Prelude.Natural)
searchPlaceIndexForPositionSummary_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> SearchPlaceIndexForPositionSummary
-> f SearchPlaceIndexForPositionSummary
searchPlaceIndexForPositionSummary_maxResults = (SearchPlaceIndexForPositionSummary -> Maybe Natural)
-> (SearchPlaceIndexForPositionSummary
    -> Maybe Natural -> SearchPlaceIndexForPositionSummary)
-> Lens
     SearchPlaceIndexForPositionSummary
     SearchPlaceIndexForPositionSummary
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchPlaceIndexForPositionSummary' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:SearchPlaceIndexForPositionSummary' :: SearchPlaceIndexForPositionSummary -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: SearchPlaceIndexForPositionSummary
s@SearchPlaceIndexForPositionSummary' {} Maybe Natural
a -> SearchPlaceIndexForPositionSummary
s {$sel:maxResults:SearchPlaceIndexForPositionSummary' :: Maybe Natural
maxResults = Maybe Natural
a} :: SearchPlaceIndexForPositionSummary)

-- | The data provider of geospatial data. Indicates one of the available
-- providers:
--
-- -   Esri
--
-- -   HERE
--
-- For additional details on data providers, see
-- <https://docs.aws.amazon.com/location/latest/developerguide/what-is-data-provider.html Amazon Location Service data providers>.
searchPlaceIndexForPositionSummary_dataSource :: Lens.Lens' SearchPlaceIndexForPositionSummary Prelude.Text
searchPlaceIndexForPositionSummary_dataSource :: (Text -> f Text)
-> SearchPlaceIndexForPositionSummary
-> f SearchPlaceIndexForPositionSummary
searchPlaceIndexForPositionSummary_dataSource = (SearchPlaceIndexForPositionSummary -> Text)
-> (SearchPlaceIndexForPositionSummary
    -> Text -> SearchPlaceIndexForPositionSummary)
-> Lens
     SearchPlaceIndexForPositionSummary
     SearchPlaceIndexForPositionSummary
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchPlaceIndexForPositionSummary' {Text
dataSource :: Text
$sel:dataSource:SearchPlaceIndexForPositionSummary' :: SearchPlaceIndexForPositionSummary -> Text
dataSource} -> Text
dataSource) (\s :: SearchPlaceIndexForPositionSummary
s@SearchPlaceIndexForPositionSummary' {} Text
a -> SearchPlaceIndexForPositionSummary
s {$sel:dataSource:SearchPlaceIndexForPositionSummary' :: Text
dataSource = Text
a} :: SearchPlaceIndexForPositionSummary)

-- | The position given in the reverse geocoding request.
searchPlaceIndexForPositionSummary_position :: Lens.Lens' SearchPlaceIndexForPositionSummary (Prelude.NonEmpty Prelude.Double)
searchPlaceIndexForPositionSummary_position :: (NonEmpty Double -> f (NonEmpty Double))
-> SearchPlaceIndexForPositionSummary
-> f SearchPlaceIndexForPositionSummary
searchPlaceIndexForPositionSummary_position = (SearchPlaceIndexForPositionSummary -> Sensitive (NonEmpty Double))
-> (SearchPlaceIndexForPositionSummary
    -> Sensitive (NonEmpty Double)
    -> SearchPlaceIndexForPositionSummary)
-> Lens
     SearchPlaceIndexForPositionSummary
     SearchPlaceIndexForPositionSummary
     (Sensitive (NonEmpty Double))
     (Sensitive (NonEmpty Double))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchPlaceIndexForPositionSummary' {Sensitive (NonEmpty Double)
position :: Sensitive (NonEmpty Double)
$sel:position:SearchPlaceIndexForPositionSummary' :: SearchPlaceIndexForPositionSummary -> Sensitive (NonEmpty Double)
position} -> Sensitive (NonEmpty Double)
position) (\s :: SearchPlaceIndexForPositionSummary
s@SearchPlaceIndexForPositionSummary' {} Sensitive (NonEmpty Double)
a -> SearchPlaceIndexForPositionSummary
s {$sel:position:SearchPlaceIndexForPositionSummary' :: Sensitive (NonEmpty Double)
position = Sensitive (NonEmpty Double)
a} :: SearchPlaceIndexForPositionSummary) ((Sensitive (NonEmpty Double) -> f (Sensitive (NonEmpty Double)))
 -> SearchPlaceIndexForPositionSummary
 -> f SearchPlaceIndexForPositionSummary)
-> ((NonEmpty Double -> f (NonEmpty Double))
    -> Sensitive (NonEmpty Double) -> f (Sensitive (NonEmpty Double)))
-> (NonEmpty Double -> f (NonEmpty Double))
-> SearchPlaceIndexForPositionSummary
-> f SearchPlaceIndexForPositionSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Double -> f (NonEmpty Double))
-> Sensitive (NonEmpty Double) -> f (Sensitive (NonEmpty Double))
forall a. Iso' (Sensitive a) a
Core._Sensitive ((NonEmpty Double -> f (NonEmpty Double))
 -> Sensitive (NonEmpty Double) -> f (Sensitive (NonEmpty Double)))
-> ((NonEmpty Double -> f (NonEmpty Double))
    -> NonEmpty Double -> f (NonEmpty Double))
-> (NonEmpty Double -> f (NonEmpty Double))
-> Sensitive (NonEmpty Double)
-> f (Sensitive (NonEmpty Double))
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Double -> f (NonEmpty Double))
-> NonEmpty Double -> f (NonEmpty Double)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance
  Core.FromJSON
    SearchPlaceIndexForPositionSummary
  where
  parseJSON :: Value -> Parser SearchPlaceIndexForPositionSummary
parseJSON =
    String
-> (Object -> Parser SearchPlaceIndexForPositionSummary)
-> Value
-> Parser SearchPlaceIndexForPositionSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SearchPlaceIndexForPositionSummary"
      ( \Object
x ->
          Maybe Natural
-> Text
-> Sensitive (NonEmpty Double)
-> SearchPlaceIndexForPositionSummary
SearchPlaceIndexForPositionSummary'
            (Maybe Natural
 -> Text
 -> Sensitive (NonEmpty Double)
 -> SearchPlaceIndexForPositionSummary)
-> Parser (Maybe Natural)
-> Parser
     (Text
      -> Sensitive (NonEmpty Double)
      -> SearchPlaceIndexForPositionSummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"MaxResults")
            Parser
  (Text
   -> Sensitive (NonEmpty Double)
   -> SearchPlaceIndexForPositionSummary)
-> Parser Text
-> Parser
     (Sensitive (NonEmpty Double) -> SearchPlaceIndexForPositionSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"DataSource")
            Parser
  (Sensitive (NonEmpty Double) -> SearchPlaceIndexForPositionSummary)
-> Parser (Sensitive (NonEmpty Double))
-> Parser SearchPlaceIndexForPositionSummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Sensitive (NonEmpty Double))
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Position")
      )

instance
  Prelude.Hashable
    SearchPlaceIndexForPositionSummary

instance
  Prelude.NFData
    SearchPlaceIndexForPositionSummary