{-# 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.TimeStreamQuery.Types.ParameterMapping
-- 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.TimeStreamQuery.Types.ParameterMapping 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
import Amazonka.TimeStreamQuery.Types.Type

-- | Mapping for named parameters.
--
-- /See:/ 'newParameterMapping' smart constructor.
data ParameterMapping = ParameterMapping'
  { -- | Parameter name.
    ParameterMapping -> Text
name :: Prelude.Text,
    ParameterMapping -> Type
type' :: Type
  }
  deriving (ParameterMapping -> ParameterMapping -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ParameterMapping -> ParameterMapping -> Bool
$c/= :: ParameterMapping -> ParameterMapping -> Bool
== :: ParameterMapping -> ParameterMapping -> Bool
$c== :: ParameterMapping -> ParameterMapping -> Bool
Prelude.Eq, ReadPrec [ParameterMapping]
ReadPrec ParameterMapping
Int -> ReadS ParameterMapping
ReadS [ParameterMapping]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ParameterMapping]
$creadListPrec :: ReadPrec [ParameterMapping]
readPrec :: ReadPrec ParameterMapping
$creadPrec :: ReadPrec ParameterMapping
readList :: ReadS [ParameterMapping]
$creadList :: ReadS [ParameterMapping]
readsPrec :: Int -> ReadS ParameterMapping
$creadsPrec :: Int -> ReadS ParameterMapping
Prelude.Read, Int -> ParameterMapping -> ShowS
[ParameterMapping] -> ShowS
ParameterMapping -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ParameterMapping] -> ShowS
$cshowList :: [ParameterMapping] -> ShowS
show :: ParameterMapping -> String
$cshow :: ParameterMapping -> String
showsPrec :: Int -> ParameterMapping -> ShowS
$cshowsPrec :: Int -> ParameterMapping -> ShowS
Prelude.Show, forall x. Rep ParameterMapping x -> ParameterMapping
forall x. ParameterMapping -> Rep ParameterMapping x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ParameterMapping x -> ParameterMapping
$cfrom :: forall x. ParameterMapping -> Rep ParameterMapping x
Prelude.Generic)

-- |
-- Create a value of 'ParameterMapping' 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:
--
-- 'name', 'parameterMapping_name' - Parameter name.
--
-- 'type'', 'parameterMapping_type' - Undocumented member.
newParameterMapping ::
  -- | 'name'
  Prelude.Text ->
  -- | 'type''
  Type ->
  ParameterMapping
newParameterMapping :: Text -> Type -> ParameterMapping
newParameterMapping Text
pName_ Type
pType_ =
  ParameterMapping' {$sel:name:ParameterMapping' :: Text
name = Text
pName_, $sel:type':ParameterMapping' :: Type
type' = Type
pType_}

-- | Parameter name.
parameterMapping_name :: Lens.Lens' ParameterMapping Prelude.Text
parameterMapping_name :: Lens' ParameterMapping Text
parameterMapping_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParameterMapping' {Text
name :: Text
$sel:name:ParameterMapping' :: ParameterMapping -> Text
name} -> Text
name) (\s :: ParameterMapping
s@ParameterMapping' {} Text
a -> ParameterMapping
s {$sel:name:ParameterMapping' :: Text
name = Text
a} :: ParameterMapping)

-- | Undocumented member.
parameterMapping_type :: Lens.Lens' ParameterMapping Type
parameterMapping_type :: Lens' ParameterMapping Type
parameterMapping_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParameterMapping' {Type
type' :: Type
$sel:type':ParameterMapping' :: ParameterMapping -> Type
type'} -> Type
type') (\s :: ParameterMapping
s@ParameterMapping' {} Type
a -> ParameterMapping
s {$sel:type':ParameterMapping' :: Type
type' = Type
a} :: ParameterMapping)

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

instance Prelude.Hashable ParameterMapping where
  hashWithSalt :: Int -> ParameterMapping -> Int
hashWithSalt Int
_salt ParameterMapping' {Text
Type
type' :: Type
name :: Text
$sel:type':ParameterMapping' :: ParameterMapping -> Type
$sel:name:ParameterMapping' :: ParameterMapping -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Type
type'

instance Prelude.NFData ParameterMapping where
  rnf :: ParameterMapping -> ()
rnf ParameterMapping' {Text
Type
type' :: Type
name :: Text
$sel:type':ParameterMapping' :: ParameterMapping -> Type
$sel:name:ParameterMapping' :: ParameterMapping -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
name seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Type
type'