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