{-# 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.LexModels.Types.InputContext where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data InputContext = InputContext'
{
InputContext -> Text
name :: Prelude.Text
}
deriving (InputContext -> InputContext -> Bool
(InputContext -> InputContext -> Bool)
-> (InputContext -> InputContext -> Bool) -> Eq InputContext
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]
(Int -> ReadS InputContext)
-> ReadS [InputContext]
-> ReadPrec InputContext
-> ReadPrec [InputContext]
-> Read 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
(Int -> InputContext -> ShowS)
-> (InputContext -> String)
-> ([InputContext] -> ShowS)
-> Show InputContext
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. InputContext -> Rep InputContext x)
-> (forall x. Rep InputContext x -> InputContext)
-> Generic InputContext
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' :: Text -> InputContext
InputContext' {$sel:name:InputContext' :: Text
name = Text
pName_}
inputContext_name :: Lens.Lens' InputContext Prelude.Text
inputContext_name :: (Text -> f Text) -> InputContext -> f InputContext
inputContext_name = (InputContext -> Text)
-> (InputContext -> Text -> InputContext)
-> Lens InputContext InputContext Text Text
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 Core.FromJSON InputContext where
parseJSON :: Value -> Parser InputContext
parseJSON =
String
-> (Object -> Parser InputContext) -> Value -> Parser InputContext
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"InputContext"
(\Object
x -> Text -> InputContext
InputContext' (Text -> InputContext) -> Parser Text -> Parser InputContext
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"name"))
instance Prelude.Hashable InputContext
instance Prelude.NFData InputContext
instance Core.ToJSON InputContext where
toJSON :: InputContext -> Value
toJSON InputContext' {Text
name :: Text
$sel:name:InputContext' :: InputContext -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name)]
)