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

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

-- | Contains relevant Places returned by calling @SearchPlaceIndexForText@.
--
-- /See:/ 'newSearchForTextResult' smart constructor.
data SearchForTextResult = SearchForTextResult'
  { -- | Contains details about the relevant point of interest.
    SearchForTextResult -> Place
place :: Place
  }
  deriving (SearchForTextResult -> SearchForTextResult -> Bool
(SearchForTextResult -> SearchForTextResult -> Bool)
-> (SearchForTextResult -> SearchForTextResult -> Bool)
-> Eq SearchForTextResult
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SearchForTextResult -> SearchForTextResult -> Bool
$c/= :: SearchForTextResult -> SearchForTextResult -> Bool
== :: SearchForTextResult -> SearchForTextResult -> Bool
$c== :: SearchForTextResult -> SearchForTextResult -> Bool
Prelude.Eq, Int -> SearchForTextResult -> ShowS
[SearchForTextResult] -> ShowS
SearchForTextResult -> String
(Int -> SearchForTextResult -> ShowS)
-> (SearchForTextResult -> String)
-> ([SearchForTextResult] -> ShowS)
-> Show SearchForTextResult
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SearchForTextResult] -> ShowS
$cshowList :: [SearchForTextResult] -> ShowS
show :: SearchForTextResult -> String
$cshow :: SearchForTextResult -> String
showsPrec :: Int -> SearchForTextResult -> ShowS
$cshowsPrec :: Int -> SearchForTextResult -> ShowS
Prelude.Show, (forall x. SearchForTextResult -> Rep SearchForTextResult x)
-> (forall x. Rep SearchForTextResult x -> SearchForTextResult)
-> Generic SearchForTextResult
forall x. Rep SearchForTextResult x -> SearchForTextResult
forall x. SearchForTextResult -> Rep SearchForTextResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SearchForTextResult x -> SearchForTextResult
$cfrom :: forall x. SearchForTextResult -> Rep SearchForTextResult x
Prelude.Generic)

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

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

instance Core.FromJSON SearchForTextResult where
  parseJSON :: Value -> Parser SearchForTextResult
parseJSON =
    String
-> (Object -> Parser SearchForTextResult)
-> Value
-> Parser SearchForTextResult
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SearchForTextResult"
      ( \Object
x ->
          Place -> SearchForTextResult
SearchForTextResult' (Place -> SearchForTextResult)
-> Parser Place -> Parser SearchForTextResult
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 SearchForTextResult

instance Prelude.NFData SearchForTextResult