{-# 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.LexRuntime.Types.GenericAttachment where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.LexRuntime.Types.Button
import qualified Amazonka.Prelude as Prelude
data GenericAttachment = GenericAttachment'
{
GenericAttachment -> Maybe [Button]
buttons :: Prelude.Maybe [Button],
GenericAttachment -> Maybe Text
subTitle :: Prelude.Maybe Prelude.Text,
GenericAttachment -> Maybe Text
imageUrl :: Prelude.Maybe Prelude.Text,
GenericAttachment -> Maybe Text
attachmentLinkUrl :: Prelude.Maybe Prelude.Text,
GenericAttachment -> Maybe Text
title :: Prelude.Maybe Prelude.Text
}
deriving (GenericAttachment -> GenericAttachment -> Bool
(GenericAttachment -> GenericAttachment -> Bool)
-> (GenericAttachment -> GenericAttachment -> Bool)
-> Eq GenericAttachment
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GenericAttachment -> GenericAttachment -> Bool
$c/= :: GenericAttachment -> GenericAttachment -> Bool
== :: GenericAttachment -> GenericAttachment -> Bool
$c== :: GenericAttachment -> GenericAttachment -> Bool
Prelude.Eq, ReadPrec [GenericAttachment]
ReadPrec GenericAttachment
Int -> ReadS GenericAttachment
ReadS [GenericAttachment]
(Int -> ReadS GenericAttachment)
-> ReadS [GenericAttachment]
-> ReadPrec GenericAttachment
-> ReadPrec [GenericAttachment]
-> Read GenericAttachment
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GenericAttachment]
$creadListPrec :: ReadPrec [GenericAttachment]
readPrec :: ReadPrec GenericAttachment
$creadPrec :: ReadPrec GenericAttachment
readList :: ReadS [GenericAttachment]
$creadList :: ReadS [GenericAttachment]
readsPrec :: Int -> ReadS GenericAttachment
$creadsPrec :: Int -> ReadS GenericAttachment
Prelude.Read, Int -> GenericAttachment -> ShowS
[GenericAttachment] -> ShowS
GenericAttachment -> String
(Int -> GenericAttachment -> ShowS)
-> (GenericAttachment -> String)
-> ([GenericAttachment] -> ShowS)
-> Show GenericAttachment
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GenericAttachment] -> ShowS
$cshowList :: [GenericAttachment] -> ShowS
show :: GenericAttachment -> String
$cshow :: GenericAttachment -> String
showsPrec :: Int -> GenericAttachment -> ShowS
$cshowsPrec :: Int -> GenericAttachment -> ShowS
Prelude.Show, (forall x. GenericAttachment -> Rep GenericAttachment x)
-> (forall x. Rep GenericAttachment x -> GenericAttachment)
-> Generic GenericAttachment
forall x. Rep GenericAttachment x -> GenericAttachment
forall x. GenericAttachment -> Rep GenericAttachment x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GenericAttachment x -> GenericAttachment
$cfrom :: forall x. GenericAttachment -> Rep GenericAttachment x
Prelude.Generic)
newGenericAttachment ::
GenericAttachment
newGenericAttachment :: GenericAttachment
newGenericAttachment =
GenericAttachment' :: Maybe [Button]
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> GenericAttachment
GenericAttachment'
{ $sel:buttons:GenericAttachment' :: Maybe [Button]
buttons = Maybe [Button]
forall a. Maybe a
Prelude.Nothing,
$sel:subTitle:GenericAttachment' :: Maybe Text
subTitle = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:imageUrl:GenericAttachment' :: Maybe Text
imageUrl = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:attachmentLinkUrl:GenericAttachment' :: Maybe Text
attachmentLinkUrl = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:title:GenericAttachment' :: Maybe Text
title = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
genericAttachment_buttons :: Lens.Lens' GenericAttachment (Prelude.Maybe [Button])
genericAttachment_buttons :: (Maybe [Button] -> f (Maybe [Button]))
-> GenericAttachment -> f GenericAttachment
genericAttachment_buttons = (GenericAttachment -> Maybe [Button])
-> (GenericAttachment -> Maybe [Button] -> GenericAttachment)
-> Lens
GenericAttachment
GenericAttachment
(Maybe [Button])
(Maybe [Button])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GenericAttachment' {Maybe [Button]
buttons :: Maybe [Button]
$sel:buttons:GenericAttachment' :: GenericAttachment -> Maybe [Button]
buttons} -> Maybe [Button]
buttons) (\s :: GenericAttachment
s@GenericAttachment' {} Maybe [Button]
a -> GenericAttachment
s {$sel:buttons:GenericAttachment' :: Maybe [Button]
buttons = Maybe [Button]
a} :: GenericAttachment) ((Maybe [Button] -> f (Maybe [Button]))
-> GenericAttachment -> f GenericAttachment)
-> ((Maybe [Button] -> f (Maybe [Button]))
-> Maybe [Button] -> f (Maybe [Button]))
-> (Maybe [Button] -> f (Maybe [Button]))
-> GenericAttachment
-> f GenericAttachment
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Button] [Button] [Button] [Button]
-> Iso
(Maybe [Button]) (Maybe [Button]) (Maybe [Button]) (Maybe [Button])
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 AnIso [Button] [Button] [Button] [Button]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
genericAttachment_subTitle :: Lens.Lens' GenericAttachment (Prelude.Maybe Prelude.Text)
genericAttachment_subTitle :: (Maybe Text -> f (Maybe Text))
-> GenericAttachment -> f GenericAttachment
genericAttachment_subTitle = (GenericAttachment -> Maybe Text)
-> (GenericAttachment -> Maybe Text -> GenericAttachment)
-> Lens
GenericAttachment GenericAttachment (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GenericAttachment' {Maybe Text
subTitle :: Maybe Text
$sel:subTitle:GenericAttachment' :: GenericAttachment -> Maybe Text
subTitle} -> Maybe Text
subTitle) (\s :: GenericAttachment
s@GenericAttachment' {} Maybe Text
a -> GenericAttachment
s {$sel:subTitle:GenericAttachment' :: Maybe Text
subTitle = Maybe Text
a} :: GenericAttachment)
genericAttachment_imageUrl :: Lens.Lens' GenericAttachment (Prelude.Maybe Prelude.Text)
genericAttachment_imageUrl :: (Maybe Text -> f (Maybe Text))
-> GenericAttachment -> f GenericAttachment
genericAttachment_imageUrl = (GenericAttachment -> Maybe Text)
-> (GenericAttachment -> Maybe Text -> GenericAttachment)
-> Lens
GenericAttachment GenericAttachment (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GenericAttachment' {Maybe Text
imageUrl :: Maybe Text
$sel:imageUrl:GenericAttachment' :: GenericAttachment -> Maybe Text
imageUrl} -> Maybe Text
imageUrl) (\s :: GenericAttachment
s@GenericAttachment' {} Maybe Text
a -> GenericAttachment
s {$sel:imageUrl:GenericAttachment' :: Maybe Text
imageUrl = Maybe Text
a} :: GenericAttachment)
genericAttachment_attachmentLinkUrl :: Lens.Lens' GenericAttachment (Prelude.Maybe Prelude.Text)
genericAttachment_attachmentLinkUrl :: (Maybe Text -> f (Maybe Text))
-> GenericAttachment -> f GenericAttachment
genericAttachment_attachmentLinkUrl = (GenericAttachment -> Maybe Text)
-> (GenericAttachment -> Maybe Text -> GenericAttachment)
-> Lens
GenericAttachment GenericAttachment (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GenericAttachment' {Maybe Text
attachmentLinkUrl :: Maybe Text
$sel:attachmentLinkUrl:GenericAttachment' :: GenericAttachment -> Maybe Text
attachmentLinkUrl} -> Maybe Text
attachmentLinkUrl) (\s :: GenericAttachment
s@GenericAttachment' {} Maybe Text
a -> GenericAttachment
s {$sel:attachmentLinkUrl:GenericAttachment' :: Maybe Text
attachmentLinkUrl = Maybe Text
a} :: GenericAttachment)
genericAttachment_title :: Lens.Lens' GenericAttachment (Prelude.Maybe Prelude.Text)
genericAttachment_title :: (Maybe Text -> f (Maybe Text))
-> GenericAttachment -> f GenericAttachment
genericAttachment_title = (GenericAttachment -> Maybe Text)
-> (GenericAttachment -> Maybe Text -> GenericAttachment)
-> Lens
GenericAttachment GenericAttachment (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GenericAttachment' {Maybe Text
title :: Maybe Text
$sel:title:GenericAttachment' :: GenericAttachment -> Maybe Text
title} -> Maybe Text
title) (\s :: GenericAttachment
s@GenericAttachment' {} Maybe Text
a -> GenericAttachment
s {$sel:title:GenericAttachment' :: Maybe Text
title = Maybe Text
a} :: GenericAttachment)
instance Core.FromJSON GenericAttachment where
parseJSON :: Value -> Parser GenericAttachment
parseJSON =
String
-> (Object -> Parser GenericAttachment)
-> Value
-> Parser GenericAttachment
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"GenericAttachment"
( \Object
x ->
Maybe [Button]
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> GenericAttachment
GenericAttachment'
(Maybe [Button]
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> GenericAttachment)
-> Parser (Maybe [Button])
-> Parser
(Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> GenericAttachment)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [Button]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"buttons" Parser (Maybe (Maybe [Button]))
-> Maybe [Button] -> Parser (Maybe [Button])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Button]
forall a. Monoid a => a
Prelude.mempty)
Parser
(Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> GenericAttachment)
-> Parser (Maybe Text)
-> Parser
(Maybe Text -> Maybe Text -> Maybe Text -> GenericAttachment)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"subTitle")
Parser
(Maybe Text -> Maybe Text -> Maybe Text -> GenericAttachment)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> GenericAttachment)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"imageUrl")
Parser (Maybe Text -> Maybe Text -> GenericAttachment)
-> Parser (Maybe Text) -> Parser (Maybe Text -> GenericAttachment)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"attachmentLinkUrl")
Parser (Maybe Text -> GenericAttachment)
-> Parser (Maybe Text) -> Parser GenericAttachment
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"title")
)
instance Prelude.Hashable GenericAttachment
instance Prelude.NFData GenericAttachment