{-# 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.ImageResponseCard where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.LexV2Models.Types.Button
import qualified Amazonka.Prelude as Prelude
data ImageResponseCard = ImageResponseCard'
{
ImageResponseCard -> Maybe [Button]
buttons :: Prelude.Maybe [Button],
ImageResponseCard -> Maybe Text
imageUrl :: Prelude.Maybe Prelude.Text,
ImageResponseCard -> Maybe Text
subtitle :: Prelude.Maybe Prelude.Text,
ImageResponseCard -> Text
title :: Prelude.Text
}
deriving (ImageResponseCard -> ImageResponseCard -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ImageResponseCard -> ImageResponseCard -> Bool
$c/= :: ImageResponseCard -> ImageResponseCard -> Bool
== :: ImageResponseCard -> ImageResponseCard -> Bool
$c== :: ImageResponseCard -> ImageResponseCard -> Bool
Prelude.Eq, ReadPrec [ImageResponseCard]
ReadPrec ImageResponseCard
Int -> ReadS ImageResponseCard
ReadS [ImageResponseCard]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ImageResponseCard]
$creadListPrec :: ReadPrec [ImageResponseCard]
readPrec :: ReadPrec ImageResponseCard
$creadPrec :: ReadPrec ImageResponseCard
readList :: ReadS [ImageResponseCard]
$creadList :: ReadS [ImageResponseCard]
readsPrec :: Int -> ReadS ImageResponseCard
$creadsPrec :: Int -> ReadS ImageResponseCard
Prelude.Read, Int -> ImageResponseCard -> ShowS
[ImageResponseCard] -> ShowS
ImageResponseCard -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ImageResponseCard] -> ShowS
$cshowList :: [ImageResponseCard] -> ShowS
show :: ImageResponseCard -> String
$cshow :: ImageResponseCard -> String
showsPrec :: Int -> ImageResponseCard -> ShowS
$cshowsPrec :: Int -> ImageResponseCard -> ShowS
Prelude.Show, forall x. Rep ImageResponseCard x -> ImageResponseCard
forall x. ImageResponseCard -> Rep ImageResponseCard x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ImageResponseCard x -> ImageResponseCard
$cfrom :: forall x. ImageResponseCard -> Rep ImageResponseCard x
Prelude.Generic)
newImageResponseCard ::
Prelude.Text ->
ImageResponseCard
newImageResponseCard :: Text -> ImageResponseCard
newImageResponseCard Text
pTitle_ =
ImageResponseCard'
{ $sel:buttons:ImageResponseCard' :: Maybe [Button]
buttons = forall a. Maybe a
Prelude.Nothing,
$sel:imageUrl:ImageResponseCard' :: Maybe Text
imageUrl = forall a. Maybe a
Prelude.Nothing,
$sel:subtitle:ImageResponseCard' :: Maybe Text
subtitle = forall a. Maybe a
Prelude.Nothing,
$sel:title:ImageResponseCard' :: Text
title = Text
pTitle_
}
imageResponseCard_buttons :: Lens.Lens' ImageResponseCard (Prelude.Maybe [Button])
imageResponseCard_buttons :: Lens' ImageResponseCard (Maybe [Button])
imageResponseCard_buttons = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImageResponseCard' {Maybe [Button]
buttons :: Maybe [Button]
$sel:buttons:ImageResponseCard' :: ImageResponseCard -> Maybe [Button]
buttons} -> Maybe [Button]
buttons) (\s :: ImageResponseCard
s@ImageResponseCard' {} Maybe [Button]
a -> ImageResponseCard
s {$sel:buttons:ImageResponseCard' :: Maybe [Button]
buttons = Maybe [Button]
a} :: ImageResponseCard) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
imageResponseCard_imageUrl :: Lens.Lens' ImageResponseCard (Prelude.Maybe Prelude.Text)
imageResponseCard_imageUrl :: Lens' ImageResponseCard (Maybe Text)
imageResponseCard_imageUrl = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImageResponseCard' {Maybe Text
imageUrl :: Maybe Text
$sel:imageUrl:ImageResponseCard' :: ImageResponseCard -> Maybe Text
imageUrl} -> Maybe Text
imageUrl) (\s :: ImageResponseCard
s@ImageResponseCard' {} Maybe Text
a -> ImageResponseCard
s {$sel:imageUrl:ImageResponseCard' :: Maybe Text
imageUrl = Maybe Text
a} :: ImageResponseCard)
imageResponseCard_subtitle :: Lens.Lens' ImageResponseCard (Prelude.Maybe Prelude.Text)
imageResponseCard_subtitle :: Lens' ImageResponseCard (Maybe Text)
imageResponseCard_subtitle = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImageResponseCard' {Maybe Text
subtitle :: Maybe Text
$sel:subtitle:ImageResponseCard' :: ImageResponseCard -> Maybe Text
subtitle} -> Maybe Text
subtitle) (\s :: ImageResponseCard
s@ImageResponseCard' {} Maybe Text
a -> ImageResponseCard
s {$sel:subtitle:ImageResponseCard' :: Maybe Text
subtitle = Maybe Text
a} :: ImageResponseCard)
imageResponseCard_title :: Lens.Lens' ImageResponseCard Prelude.Text
imageResponseCard_title :: Lens' ImageResponseCard Text
imageResponseCard_title = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImageResponseCard' {Text
title :: Text
$sel:title:ImageResponseCard' :: ImageResponseCard -> Text
title} -> Text
title) (\s :: ImageResponseCard
s@ImageResponseCard' {} Text
a -> ImageResponseCard
s {$sel:title:ImageResponseCard' :: Text
title = Text
a} :: ImageResponseCard)
instance Data.FromJSON ImageResponseCard where
parseJSON :: Value -> Parser ImageResponseCard
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"ImageResponseCard"
( \Object
x ->
Maybe [Button]
-> Maybe Text -> Maybe Text -> Text -> ImageResponseCard
ImageResponseCard'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"buttons" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"imageUrl")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"subtitle")
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
"title")
)
instance Prelude.Hashable ImageResponseCard where
hashWithSalt :: Int -> ImageResponseCard -> Int
hashWithSalt Int
_salt ImageResponseCard' {Maybe [Button]
Maybe Text
Text
title :: Text
subtitle :: Maybe Text
imageUrl :: Maybe Text
buttons :: Maybe [Button]
$sel:title:ImageResponseCard' :: ImageResponseCard -> Text
$sel:subtitle:ImageResponseCard' :: ImageResponseCard -> Maybe Text
$sel:imageUrl:ImageResponseCard' :: ImageResponseCard -> Maybe Text
$sel:buttons:ImageResponseCard' :: ImageResponseCard -> Maybe [Button]
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Button]
buttons
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
imageUrl
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
subtitle
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
title
instance Prelude.NFData ImageResponseCard where
rnf :: ImageResponseCard -> ()
rnf ImageResponseCard' {Maybe [Button]
Maybe Text
Text
title :: Text
subtitle :: Maybe Text
imageUrl :: Maybe Text
buttons :: Maybe [Button]
$sel:title:ImageResponseCard' :: ImageResponseCard -> Text
$sel:subtitle:ImageResponseCard' :: ImageResponseCard -> Maybe Text
$sel:imageUrl:ImageResponseCard' :: ImageResponseCard -> Maybe Text
$sel:buttons:ImageResponseCard' :: ImageResponseCard -> Maybe [Button]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [Button]
buttons
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
imageUrl
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
subtitle
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
title
instance Data.ToJSON ImageResponseCard where
toJSON :: ImageResponseCard -> Value
toJSON ImageResponseCard' {Maybe [Button]
Maybe Text
Text
title :: Text
subtitle :: Maybe Text
imageUrl :: Maybe Text
buttons :: Maybe [Button]
$sel:title:ImageResponseCard' :: ImageResponseCard -> Text
$sel:subtitle:ImageResponseCard' :: ImageResponseCard -> Maybe Text
$sel:imageUrl:ImageResponseCard' :: ImageResponseCard -> Maybe Text
$sel:buttons:ImageResponseCard' :: ImageResponseCard -> Maybe [Button]
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"buttons" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Button]
buttons,
(Key
"imageUrl" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
imageUrl,
(Key
"subtitle" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
subtitle,
forall a. a -> Maybe a
Prelude.Just (Key
"title" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
title)
]
)