{-# 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 #-}
module Amazonka.LexV2Models.Types.InputContext 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
data InputContext = InputContext'
{
InputContext -> Text
name :: Prelude.Text
}
deriving (InputContext -> InputContext -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InputContext -> InputContext -> Bool
$c/= :: InputContext -> InputContext -> Bool
== :: InputContext -> InputContext -> Bool
$c== :: InputContext -> InputContext -> Bool
Prelude.Eq, ReadPrec [InputContext]
ReadPrec InputContext
Int -> ReadS InputContext
ReadS [InputContext]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InputContext]
$creadListPrec :: ReadPrec [InputContext]
readPrec :: ReadPrec InputContext
$creadPrec :: ReadPrec InputContext
readList :: ReadS [InputContext]
$creadList :: ReadS [InputContext]
readsPrec :: Int -> ReadS InputContext
$creadsPrec :: Int -> ReadS InputContext
Prelude.Read, Int -> InputContext -> ShowS
[InputContext] -> ShowS
InputContext -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InputContext] -> ShowS
$cshowList :: [InputContext] -> ShowS
show :: InputContext -> String
$cshow :: InputContext -> String
showsPrec :: Int -> InputContext -> ShowS
$cshowsPrec :: Int -> InputContext -> ShowS
Prelude.Show, forall x. Rep InputContext x -> InputContext
forall x. InputContext -> Rep InputContext x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InputContext x -> InputContext
$cfrom :: forall x. InputContext -> Rep InputContext x
Prelude.Generic)
newInputContext ::
Prelude.Text ->
InputContext
newInputContext :: Text -> InputContext
newInputContext Text
pName_ = InputContext' {$sel:name:InputContext' :: Text
name = Text
pName_}
inputContext_name :: Lens.Lens' InputContext Prelude.Text
inputContext_name :: Lens' InputContext Text
inputContext_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputContext' {Text
name :: Text
$sel:name:InputContext' :: InputContext -> Text
name} -> Text
name) (\s :: InputContext
s@InputContext' {} Text
a -> InputContext
s {$sel:name:InputContext' :: Text
name = Text
a} :: InputContext)
instance Data.FromJSON InputContext where
parseJSON :: Value -> Parser InputContext
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"InputContext"
(\Object
x -> Text -> InputContext
InputContext' 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"))
instance Prelude.Hashable InputContext where
hashWithSalt :: Int -> InputContext -> Int
hashWithSalt Int
_salt InputContext' {Text
name :: Text
$sel:name:InputContext' :: InputContext -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
instance Prelude.NFData InputContext where
rnf :: InputContext -> ()
rnf InputContext' {Text
name :: Text
$sel:name:InputContext' :: InputContext -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
name
instance Data.ToJSON InputContext where
toJSON :: InputContext -> Value
toJSON InputContext' {Text
name :: Text
$sel:name:InputContext' :: InputContext -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[forall a. a -> Maybe a
Prelude.Just (Key
"name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name)]
)