{-# 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.MapMatchingConfig
-- 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.MapMatchingConfig 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:/ 'newMapMatchingConfig' smart constructor.
data MapMatchingConfig = MapMatchingConfig'
  { MapMatchingConfig -> Text
idAttributeName :: Prelude.Text,
    -- | The name of the timestamp attribute.
    MapMatchingConfig -> Text
timestampAttributeName :: Prelude.Text,
    -- | The name of the X-attribute
    MapMatchingConfig -> Text
xAttributeName :: Prelude.Text,
    -- | The name of the Y-attribute
    MapMatchingConfig -> Text
yAttributeName :: Prelude.Text
  }
  deriving (MapMatchingConfig -> MapMatchingConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MapMatchingConfig -> MapMatchingConfig -> Bool
$c/= :: MapMatchingConfig -> MapMatchingConfig -> Bool
== :: MapMatchingConfig -> MapMatchingConfig -> Bool
$c== :: MapMatchingConfig -> MapMatchingConfig -> Bool
Prelude.Eq, ReadPrec [MapMatchingConfig]
ReadPrec MapMatchingConfig
Int -> ReadS MapMatchingConfig
ReadS [MapMatchingConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MapMatchingConfig]
$creadListPrec :: ReadPrec [MapMatchingConfig]
readPrec :: ReadPrec MapMatchingConfig
$creadPrec :: ReadPrec MapMatchingConfig
readList :: ReadS [MapMatchingConfig]
$creadList :: ReadS [MapMatchingConfig]
readsPrec :: Int -> ReadS MapMatchingConfig
$creadsPrec :: Int -> ReadS MapMatchingConfig
Prelude.Read, Int -> MapMatchingConfig -> ShowS
[MapMatchingConfig] -> ShowS
MapMatchingConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MapMatchingConfig] -> ShowS
$cshowList :: [MapMatchingConfig] -> ShowS
show :: MapMatchingConfig -> String
$cshow :: MapMatchingConfig -> String
showsPrec :: Int -> MapMatchingConfig -> ShowS
$cshowsPrec :: Int -> MapMatchingConfig -> ShowS
Prelude.Show, forall x. Rep MapMatchingConfig x -> MapMatchingConfig
forall x. MapMatchingConfig -> Rep MapMatchingConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MapMatchingConfig x -> MapMatchingConfig
$cfrom :: forall x. MapMatchingConfig -> Rep MapMatchingConfig x
Prelude.Generic)

-- |
-- Create a value of 'MapMatchingConfig' 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:
--
-- 'idAttributeName', 'mapMatchingConfig_idAttributeName' -
--
-- 'timestampAttributeName', 'mapMatchingConfig_timestampAttributeName' - The name of the timestamp attribute.
--
-- 'xAttributeName', 'mapMatchingConfig_xAttributeName' - The name of the X-attribute
--
-- 'yAttributeName', 'mapMatchingConfig_yAttributeName' - The name of the Y-attribute
newMapMatchingConfig ::
  -- | 'idAttributeName'
  Prelude.Text ->
  -- | 'timestampAttributeName'
  Prelude.Text ->
  -- | 'xAttributeName'
  Prelude.Text ->
  -- | 'yAttributeName'
  Prelude.Text ->
  MapMatchingConfig
newMapMatchingConfig :: Text -> Text -> Text -> Text -> MapMatchingConfig
newMapMatchingConfig
  Text
pIdAttributeName_
  Text
pTimestampAttributeName_
  Text
pXAttributeName_
  Text
pYAttributeName_ =
    MapMatchingConfig'
      { $sel:idAttributeName:MapMatchingConfig' :: Text
idAttributeName =
          Text
pIdAttributeName_,
        $sel:timestampAttributeName:MapMatchingConfig' :: Text
timestampAttributeName = Text
pTimestampAttributeName_,
        $sel:xAttributeName:MapMatchingConfig' :: Text
xAttributeName = Text
pXAttributeName_,
        $sel:yAttributeName:MapMatchingConfig' :: Text
yAttributeName = Text
pYAttributeName_
      }

mapMatchingConfig_idAttributeName :: Lens.Lens' MapMatchingConfig Prelude.Text
mapMatchingConfig_idAttributeName :: Lens' MapMatchingConfig Text
mapMatchingConfig_idAttributeName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MapMatchingConfig' {Text
idAttributeName :: Text
$sel:idAttributeName:MapMatchingConfig' :: MapMatchingConfig -> Text
idAttributeName} -> Text
idAttributeName) (\s :: MapMatchingConfig
s@MapMatchingConfig' {} Text
a -> MapMatchingConfig
s {$sel:idAttributeName:MapMatchingConfig' :: Text
idAttributeName = Text
a} :: MapMatchingConfig)

-- | The name of the timestamp attribute.
mapMatchingConfig_timestampAttributeName :: Lens.Lens' MapMatchingConfig Prelude.Text
mapMatchingConfig_timestampAttributeName :: Lens' MapMatchingConfig Text
mapMatchingConfig_timestampAttributeName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MapMatchingConfig' {Text
timestampAttributeName :: Text
$sel:timestampAttributeName:MapMatchingConfig' :: MapMatchingConfig -> Text
timestampAttributeName} -> Text
timestampAttributeName) (\s :: MapMatchingConfig
s@MapMatchingConfig' {} Text
a -> MapMatchingConfig
s {$sel:timestampAttributeName:MapMatchingConfig' :: Text
timestampAttributeName = Text
a} :: MapMatchingConfig)

-- | The name of the X-attribute
mapMatchingConfig_xAttributeName :: Lens.Lens' MapMatchingConfig Prelude.Text
mapMatchingConfig_xAttributeName :: Lens' MapMatchingConfig Text
mapMatchingConfig_xAttributeName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MapMatchingConfig' {Text
xAttributeName :: Text
$sel:xAttributeName:MapMatchingConfig' :: MapMatchingConfig -> Text
xAttributeName} -> Text
xAttributeName) (\s :: MapMatchingConfig
s@MapMatchingConfig' {} Text
a -> MapMatchingConfig
s {$sel:xAttributeName:MapMatchingConfig' :: Text
xAttributeName = Text
a} :: MapMatchingConfig)

-- | The name of the Y-attribute
mapMatchingConfig_yAttributeName :: Lens.Lens' MapMatchingConfig Prelude.Text
mapMatchingConfig_yAttributeName :: Lens' MapMatchingConfig Text
mapMatchingConfig_yAttributeName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MapMatchingConfig' {Text
yAttributeName :: Text
$sel:yAttributeName:MapMatchingConfig' :: MapMatchingConfig -> Text
yAttributeName} -> Text
yAttributeName) (\s :: MapMatchingConfig
s@MapMatchingConfig' {} Text
a -> MapMatchingConfig
s {$sel:yAttributeName:MapMatchingConfig' :: Text
yAttributeName = Text
a} :: MapMatchingConfig)

instance Data.FromJSON MapMatchingConfig where
  parseJSON :: Value -> Parser MapMatchingConfig
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"MapMatchingConfig"
      ( \Object
x ->
          Text -> Text -> Text -> Text -> MapMatchingConfig
MapMatchingConfig'
            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
"IdAttributeName")
            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
"TimestampAttributeName")
            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
"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 MapMatchingConfig where
  hashWithSalt :: Int -> MapMatchingConfig -> Int
hashWithSalt Int
_salt MapMatchingConfig' {Text
yAttributeName :: Text
xAttributeName :: Text
timestampAttributeName :: Text
idAttributeName :: Text
$sel:yAttributeName:MapMatchingConfig' :: MapMatchingConfig -> Text
$sel:xAttributeName:MapMatchingConfig' :: MapMatchingConfig -> Text
$sel:timestampAttributeName:MapMatchingConfig' :: MapMatchingConfig -> Text
$sel:idAttributeName:MapMatchingConfig' :: MapMatchingConfig -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
idAttributeName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
timestampAttributeName
      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 MapMatchingConfig where
  rnf :: MapMatchingConfig -> ()
rnf MapMatchingConfig' {Text
yAttributeName :: Text
xAttributeName :: Text
timestampAttributeName :: Text
idAttributeName :: Text
$sel:yAttributeName:MapMatchingConfig' :: MapMatchingConfig -> Text
$sel:xAttributeName:MapMatchingConfig' :: MapMatchingConfig -> Text
$sel:timestampAttributeName:MapMatchingConfig' :: MapMatchingConfig -> Text
$sel:idAttributeName:MapMatchingConfig' :: MapMatchingConfig -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
idAttributeName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
timestampAttributeName
      seq :: forall a b. a -> b -> b
`Prelude.seq` 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 MapMatchingConfig where
  toJSON :: MapMatchingConfig -> Value
toJSON MapMatchingConfig' {Text
yAttributeName :: Text
xAttributeName :: Text
timestampAttributeName :: Text
idAttributeName :: Text
$sel:yAttributeName:MapMatchingConfig' :: MapMatchingConfig -> Text
$sel:xAttributeName:MapMatchingConfig' :: MapMatchingConfig -> Text
$sel:timestampAttributeName:MapMatchingConfig' :: MapMatchingConfig -> Text
$sel:idAttributeName:MapMatchingConfig' :: MapMatchingConfig -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"IdAttributeName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
idAttributeName),
            forall a. a -> Maybe a
Prelude.Just
              ( Key
"TimestampAttributeName"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
timestampAttributeName
              ),
            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)
          ]
      )