{-# 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.SageMakerGeoSpatial.Types.ReverseGeocodingConfig
-- 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.SageMakerGeoSpatial.Types.ReverseGeocodingConfig 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

-- |
--
-- /See:/ 'newReverseGeocodingConfig' smart constructor.
data ReverseGeocodingConfig = ReverseGeocodingConfig'
  { ReverseGeocodingConfig -> Text
xAttributeName :: Prelude.Text,
    ReverseGeocodingConfig -> Text
yAttributeName :: Prelude.Text
  }
  deriving (ReverseGeocodingConfig -> ReverseGeocodingConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ReverseGeocodingConfig -> ReverseGeocodingConfig -> Bool
$c/= :: ReverseGeocodingConfig -> ReverseGeocodingConfig -> Bool
== :: ReverseGeocodingConfig -> ReverseGeocodingConfig -> Bool
$c== :: ReverseGeocodingConfig -> ReverseGeocodingConfig -> Bool
Prelude.Eq, ReadPrec [ReverseGeocodingConfig]
ReadPrec ReverseGeocodingConfig
Int -> ReadS ReverseGeocodingConfig
ReadS [ReverseGeocodingConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ReverseGeocodingConfig]
$creadListPrec :: ReadPrec [ReverseGeocodingConfig]
readPrec :: ReadPrec ReverseGeocodingConfig
$creadPrec :: ReadPrec ReverseGeocodingConfig
readList :: ReadS [ReverseGeocodingConfig]
$creadList :: ReadS [ReverseGeocodingConfig]
readsPrec :: Int -> ReadS ReverseGeocodingConfig
$creadsPrec :: Int -> ReadS ReverseGeocodingConfig
Prelude.Read, Int -> ReverseGeocodingConfig -> ShowS
[ReverseGeocodingConfig] -> ShowS
ReverseGeocodingConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ReverseGeocodingConfig] -> ShowS
$cshowList :: [ReverseGeocodingConfig] -> ShowS
show :: ReverseGeocodingConfig -> String
$cshow :: ReverseGeocodingConfig -> String
showsPrec :: Int -> ReverseGeocodingConfig -> ShowS
$cshowsPrec :: Int -> ReverseGeocodingConfig -> ShowS
Prelude.Show, forall x. Rep ReverseGeocodingConfig x -> ReverseGeocodingConfig
forall x. ReverseGeocodingConfig -> Rep ReverseGeocodingConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ReverseGeocodingConfig x -> ReverseGeocodingConfig
$cfrom :: forall x. ReverseGeocodingConfig -> Rep ReverseGeocodingConfig x
Prelude.Generic)

-- |
-- Create a value of 'ReverseGeocodingConfig' 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:
--
-- 'xAttributeName', 'reverseGeocodingConfig_xAttributeName' -
--
-- 'yAttributeName', 'reverseGeocodingConfig_yAttributeName' -
newReverseGeocodingConfig ::
  -- | 'xAttributeName'
  Prelude.Text ->
  -- | 'yAttributeName'
  Prelude.Text ->
  ReverseGeocodingConfig
newReverseGeocodingConfig :: Text -> Text -> ReverseGeocodingConfig
newReverseGeocodingConfig
  Text
pXAttributeName_
  Text
pYAttributeName_ =
    ReverseGeocodingConfig'
      { $sel:xAttributeName:ReverseGeocodingConfig' :: Text
xAttributeName =
          Text
pXAttributeName_,
        $sel:yAttributeName:ReverseGeocodingConfig' :: Text
yAttributeName = Text
pYAttributeName_
      }

reverseGeocodingConfig_xAttributeName :: Lens.Lens' ReverseGeocodingConfig Prelude.Text
reverseGeocodingConfig_xAttributeName :: Lens' ReverseGeocodingConfig Text
reverseGeocodingConfig_xAttributeName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReverseGeocodingConfig' {Text
xAttributeName :: Text
$sel:xAttributeName:ReverseGeocodingConfig' :: ReverseGeocodingConfig -> Text
xAttributeName} -> Text
xAttributeName) (\s :: ReverseGeocodingConfig
s@ReverseGeocodingConfig' {} Text
a -> ReverseGeocodingConfig
s {$sel:xAttributeName:ReverseGeocodingConfig' :: Text
xAttributeName = Text
a} :: ReverseGeocodingConfig)

reverseGeocodingConfig_yAttributeName :: Lens.Lens' ReverseGeocodingConfig Prelude.Text
reverseGeocodingConfig_yAttributeName :: Lens' ReverseGeocodingConfig Text
reverseGeocodingConfig_yAttributeName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReverseGeocodingConfig' {Text
yAttributeName :: Text
$sel:yAttributeName:ReverseGeocodingConfig' :: ReverseGeocodingConfig -> Text
yAttributeName} -> Text
yAttributeName) (\s :: ReverseGeocodingConfig
s@ReverseGeocodingConfig' {} Text
a -> ReverseGeocodingConfig
s {$sel:yAttributeName:ReverseGeocodingConfig' :: Text
yAttributeName = Text
a} :: ReverseGeocodingConfig)

instance Data.FromJSON ReverseGeocodingConfig where
  parseJSON :: Value -> Parser ReverseGeocodingConfig
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ReverseGeocodingConfig"
      ( \Object
x ->
          Text -> Text -> ReverseGeocodingConfig
ReverseGeocodingConfig'
            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
"XAttributeName")
            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
"YAttributeName")
      )

instance Prelude.Hashable ReverseGeocodingConfig where
  hashWithSalt :: Int -> ReverseGeocodingConfig -> Int
hashWithSalt Int
_salt ReverseGeocodingConfig' {Text
yAttributeName :: Text
xAttributeName :: Text
$sel:yAttributeName:ReverseGeocodingConfig' :: ReverseGeocodingConfig -> Text
$sel:xAttributeName:ReverseGeocodingConfig' :: ReverseGeocodingConfig -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
xAttributeName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
yAttributeName

instance Prelude.NFData ReverseGeocodingConfig where
  rnf :: ReverseGeocodingConfig -> ()
rnf ReverseGeocodingConfig' {Text
yAttributeName :: Text
xAttributeName :: Text
$sel:yAttributeName:ReverseGeocodingConfig' :: ReverseGeocodingConfig -> Text
$sel:xAttributeName:ReverseGeocodingConfig' :: ReverseGeocodingConfig -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
xAttributeName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
yAttributeName

instance Data.ToJSON ReverseGeocodingConfig where
  toJSON :: ReverseGeocodingConfig -> Value
toJSON ReverseGeocodingConfig' {Text
yAttributeName :: Text
xAttributeName :: Text
$sel:yAttributeName:ReverseGeocodingConfig' :: ReverseGeocodingConfig -> Text
$sel:xAttributeName:ReverseGeocodingConfig' :: ReverseGeocodingConfig -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"XAttributeName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
xAttributeName),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"YAttributeName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
yAttributeName)
          ]
      )