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

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

-- | A summary of the request sent by using @SearchPlaceIndexForPosition@.
--
-- /See:/ 'newSearchPlaceIndexForPositionSummary' smart constructor.
data SearchPlaceIndexForPositionSummary = SearchPlaceIndexForPositionSummary'
  { -- | The preferred language used to return results. Matches the language in
    -- the request. The value is a valid
    -- <https://tools.ietf.org/search/bcp47 BCP 47> language tag, for example,
    -- @en@ for English.
    SearchPlaceIndexForPositionSummary -> Maybe Text
language :: Prelude.Maybe Prelude.Text,
    -- | Contains the optional result count limit that is specified in the
    -- request.
    --
    -- Default value: @50@
    SearchPlaceIndexForPositionSummary -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The geospatial data provider attached to the place index resource
    -- specified in the request. Values can be one of the following:
    --
    -- -   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>.
    SearchPlaceIndexForPositionSummary -> Text
dataSource :: Prelude.Text,
    -- | The position specified in the request.
    SearchPlaceIndexForPositionSummary -> Sensitive (NonEmpty Double)
position :: Data.Sensitive (Prelude.NonEmpty Prelude.Double)
  }
  deriving (SearchPlaceIndexForPositionSummary
-> SearchPlaceIndexForPositionSummary -> Bool
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
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.
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:
--
-- 'language', 'searchPlaceIndexForPositionSummary_language' - The preferred language used to return results. Matches the language in
-- the request. The value is a valid
-- <https://tools.ietf.org/search/bcp47 BCP 47> language tag, for example,
-- @en@ for English.
--
-- 'maxResults', 'searchPlaceIndexForPositionSummary_maxResults' - Contains the optional result count limit that is specified in the
-- request.
--
-- Default value: @50@
--
-- 'dataSource', 'searchPlaceIndexForPositionSummary_dataSource' - The geospatial data provider attached to the place index resource
-- specified in the request. Values can be one of the following:
--
-- -   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>.
--
-- 'position', 'searchPlaceIndexForPositionSummary_position' - The position specified in the request.
newSearchPlaceIndexForPositionSummary ::
  -- | 'dataSource'
  Prelude.Text ->
  -- | 'position'
  Prelude.NonEmpty Prelude.Double ->
  SearchPlaceIndexForPositionSummary
newSearchPlaceIndexForPositionSummary :: Text -> NonEmpty Double -> SearchPlaceIndexForPositionSummary
newSearchPlaceIndexForPositionSummary
  Text
pDataSource_
  NonEmpty Double
pPosition_ =
    SearchPlaceIndexForPositionSummary'
      { $sel:language:SearchPlaceIndexForPositionSummary' :: Maybe Text
language =
          forall a. Maybe a
Prelude.Nothing,
        $sel:maxResults:SearchPlaceIndexForPositionSummary' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
        $sel:dataSource:SearchPlaceIndexForPositionSummary' :: Text
dataSource = Text
pDataSource_,
        $sel:position:SearchPlaceIndexForPositionSummary' :: Sensitive (NonEmpty Double)
position =
          forall a. Iso' (Sensitive a) a
Data._Sensitive
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
            forall t b. AReview t b -> b -> t
Lens.# NonEmpty Double
pPosition_
      }

-- | The preferred language used to return results. Matches the language in
-- the request. The value is a valid
-- <https://tools.ietf.org/search/bcp47 BCP 47> language tag, for example,
-- @en@ for English.
searchPlaceIndexForPositionSummary_language :: Lens.Lens' SearchPlaceIndexForPositionSummary (Prelude.Maybe Prelude.Text)
searchPlaceIndexForPositionSummary_language :: Lens' SearchPlaceIndexForPositionSummary (Maybe Text)
searchPlaceIndexForPositionSummary_language = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchPlaceIndexForPositionSummary' {Maybe Text
language :: Maybe Text
$sel:language:SearchPlaceIndexForPositionSummary' :: SearchPlaceIndexForPositionSummary -> Maybe Text
language} -> Maybe Text
language) (\s :: SearchPlaceIndexForPositionSummary
s@SearchPlaceIndexForPositionSummary' {} Maybe Text
a -> SearchPlaceIndexForPositionSummary
s {$sel:language:SearchPlaceIndexForPositionSummary' :: Maybe Text
language = Maybe Text
a} :: SearchPlaceIndexForPositionSummary)

-- | Contains the optional result count limit that is specified in the
-- request.
--
-- Default value: @50@
searchPlaceIndexForPositionSummary_maxResults :: Lens.Lens' SearchPlaceIndexForPositionSummary (Prelude.Maybe Prelude.Natural)
searchPlaceIndexForPositionSummary_maxResults :: Lens' SearchPlaceIndexForPositionSummary (Maybe Natural)
searchPlaceIndexForPositionSummary_maxResults = 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 geospatial data provider attached to the place index resource
-- specified in the request. Values can be one of the following:
--
-- -   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>.
searchPlaceIndexForPositionSummary_dataSource :: Lens.Lens' SearchPlaceIndexForPositionSummary Prelude.Text
searchPlaceIndexForPositionSummary_dataSource :: Lens' SearchPlaceIndexForPositionSummary Text
searchPlaceIndexForPositionSummary_dataSource = 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 specified in the request.
searchPlaceIndexForPositionSummary_position :: Lens.Lens' SearchPlaceIndexForPositionSummary (Prelude.NonEmpty Prelude.Double)
searchPlaceIndexForPositionSummary_position :: Lens' SearchPlaceIndexForPositionSummary (NonEmpty Double)
searchPlaceIndexForPositionSummary_position = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a. Iso' (Sensitive a) a
Data._Sensitive forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.Hashable
    SearchPlaceIndexForPositionSummary
  where
  hashWithSalt :: Int -> SearchPlaceIndexForPositionSummary -> Int
hashWithSalt
    Int
_salt
    SearchPlaceIndexForPositionSummary' {Maybe Natural
Maybe Text
Text
Sensitive (NonEmpty Double)
position :: Sensitive (NonEmpty Double)
dataSource :: Text
maxResults :: Maybe Natural
language :: Maybe Text
$sel:position:SearchPlaceIndexForPositionSummary' :: SearchPlaceIndexForPositionSummary -> Sensitive (NonEmpty Double)
$sel:dataSource:SearchPlaceIndexForPositionSummary' :: SearchPlaceIndexForPositionSummary -> Text
$sel:maxResults:SearchPlaceIndexForPositionSummary' :: SearchPlaceIndexForPositionSummary -> Maybe Natural
$sel:language:SearchPlaceIndexForPositionSummary' :: SearchPlaceIndexForPositionSummary -> Maybe Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
language
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
dataSource
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Sensitive (NonEmpty Double)
position

instance
  Prelude.NFData
    SearchPlaceIndexForPositionSummary
  where
  rnf :: SearchPlaceIndexForPositionSummary -> ()
rnf SearchPlaceIndexForPositionSummary' {Maybe Natural
Maybe Text
Text
Sensitive (NonEmpty Double)
position :: Sensitive (NonEmpty Double)
dataSource :: Text
maxResults :: Maybe Natural
language :: Maybe Text
$sel:position:SearchPlaceIndexForPositionSummary' :: SearchPlaceIndexForPositionSummary -> Sensitive (NonEmpty Double)
$sel:dataSource:SearchPlaceIndexForPositionSummary' :: SearchPlaceIndexForPositionSummary -> Text
$sel:maxResults:SearchPlaceIndexForPositionSummary' :: SearchPlaceIndexForPositionSummary -> Maybe Natural
$sel:language:SearchPlaceIndexForPositionSummary' :: SearchPlaceIndexForPositionSummary -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
language
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
      seq :: forall a b. a -> b -> b
`Prelude.seq` 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 Sensitive (NonEmpty Double)
position