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

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

-- | Specifies a single point of interest, or Place as a result of a search
-- query obtained from a dataset configured in the place index resource.
--
-- /See:/ 'newSearchForPositionResult' smart constructor.
data SearchForPositionResult = SearchForPositionResult'
  { -- | Contains details about the relevant point of interest.
    SearchForPositionResult -> Place
place :: Place
  }
  deriving (SearchForPositionResult -> SearchForPositionResult -> Bool
(SearchForPositionResult -> SearchForPositionResult -> Bool)
-> (SearchForPositionResult -> SearchForPositionResult -> Bool)
-> Eq SearchForPositionResult
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SearchForPositionResult -> SearchForPositionResult -> Bool
$c/= :: SearchForPositionResult -> SearchForPositionResult -> Bool
== :: SearchForPositionResult -> SearchForPositionResult -> Bool
$c== :: SearchForPositionResult -> SearchForPositionResult -> Bool
Prelude.Eq, Int -> SearchForPositionResult -> ShowS
[SearchForPositionResult] -> ShowS
SearchForPositionResult -> String
(Int -> SearchForPositionResult -> ShowS)
-> (SearchForPositionResult -> String)
-> ([SearchForPositionResult] -> ShowS)
-> Show SearchForPositionResult
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SearchForPositionResult] -> ShowS
$cshowList :: [SearchForPositionResult] -> ShowS
show :: SearchForPositionResult -> String
$cshow :: SearchForPositionResult -> String
showsPrec :: Int -> SearchForPositionResult -> ShowS
$cshowsPrec :: Int -> SearchForPositionResult -> ShowS
Prelude.Show, (forall x.
 SearchForPositionResult -> Rep SearchForPositionResult x)
-> (forall x.
    Rep SearchForPositionResult x -> SearchForPositionResult)
-> Generic SearchForPositionResult
forall x. Rep SearchForPositionResult x -> SearchForPositionResult
forall x. SearchForPositionResult -> Rep SearchForPositionResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SearchForPositionResult x -> SearchForPositionResult
$cfrom :: forall x. SearchForPositionResult -> Rep SearchForPositionResult x
Prelude.Generic)

-- |
-- Create a value of 'SearchForPositionResult' 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:
--
-- 'place', 'searchForPositionResult_place' - Contains details about the relevant point of interest.
newSearchForPositionResult ::
  -- | 'place'
  Place ->
  SearchForPositionResult
newSearchForPositionResult :: Place -> SearchForPositionResult
newSearchForPositionResult Place
pPlace_ =
  SearchForPositionResult' :: Place -> SearchForPositionResult
SearchForPositionResult' {$sel:place:SearchForPositionResult' :: Place
place = Place
pPlace_}

-- | Contains details about the relevant point of interest.
searchForPositionResult_place :: Lens.Lens' SearchForPositionResult Place
searchForPositionResult_place :: (Place -> f Place)
-> SearchForPositionResult -> f SearchForPositionResult
searchForPositionResult_place = (SearchForPositionResult -> Place)
-> (SearchForPositionResult -> Place -> SearchForPositionResult)
-> Lens SearchForPositionResult SearchForPositionResult Place Place
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchForPositionResult' {Place
place :: Place
$sel:place:SearchForPositionResult' :: SearchForPositionResult -> Place
place} -> Place
place) (\s :: SearchForPositionResult
s@SearchForPositionResult' {} Place
a -> SearchForPositionResult
s {$sel:place:SearchForPositionResult' :: Place
place = Place
a} :: SearchForPositionResult)

instance Core.FromJSON SearchForPositionResult where
  parseJSON :: Value -> Parser SearchForPositionResult
parseJSON =
    String
-> (Object -> Parser SearchForPositionResult)
-> Value
-> Parser SearchForPositionResult
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SearchForPositionResult"
      ( \Object
x ->
          Place -> SearchForPositionResult
SearchForPositionResult'
            (Place -> SearchForPositionResult)
-> Parser Place -> Parser SearchForPositionResult
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Place
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Place")
      )

instance Prelude.Hashable SearchForPositionResult

instance Prelude.NFData SearchForPositionResult