{-# 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.ResponseSpecification 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.MessageGroup
import qualified Amazonka.Prelude as Prelude
data ResponseSpecification = ResponseSpecification'
{
ResponseSpecification -> Maybe Bool
allowInterrupt :: Prelude.Maybe Prelude.Bool,
ResponseSpecification -> NonEmpty MessageGroup
messageGroups :: Prelude.NonEmpty MessageGroup
}
deriving (ResponseSpecification -> ResponseSpecification -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResponseSpecification -> ResponseSpecification -> Bool
$c/= :: ResponseSpecification -> ResponseSpecification -> Bool
== :: ResponseSpecification -> ResponseSpecification -> Bool
$c== :: ResponseSpecification -> ResponseSpecification -> Bool
Prelude.Eq, ReadPrec [ResponseSpecification]
ReadPrec ResponseSpecification
Int -> ReadS ResponseSpecification
ReadS [ResponseSpecification]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResponseSpecification]
$creadListPrec :: ReadPrec [ResponseSpecification]
readPrec :: ReadPrec ResponseSpecification
$creadPrec :: ReadPrec ResponseSpecification
readList :: ReadS [ResponseSpecification]
$creadList :: ReadS [ResponseSpecification]
readsPrec :: Int -> ReadS ResponseSpecification
$creadsPrec :: Int -> ReadS ResponseSpecification
Prelude.Read, Int -> ResponseSpecification -> ShowS
[ResponseSpecification] -> ShowS
ResponseSpecification -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResponseSpecification] -> ShowS
$cshowList :: [ResponseSpecification] -> ShowS
show :: ResponseSpecification -> String
$cshow :: ResponseSpecification -> String
showsPrec :: Int -> ResponseSpecification -> ShowS
$cshowsPrec :: Int -> ResponseSpecification -> ShowS
Prelude.Show, forall x. Rep ResponseSpecification x -> ResponseSpecification
forall x. ResponseSpecification -> Rep ResponseSpecification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ResponseSpecification x -> ResponseSpecification
$cfrom :: forall x. ResponseSpecification -> Rep ResponseSpecification x
Prelude.Generic)
newResponseSpecification ::
Prelude.NonEmpty MessageGroup ->
ResponseSpecification
newResponseSpecification :: NonEmpty MessageGroup -> ResponseSpecification
newResponseSpecification NonEmpty MessageGroup
pMessageGroups_ =
ResponseSpecification'
{ $sel:allowInterrupt:ResponseSpecification' :: Maybe Bool
allowInterrupt =
forall a. Maybe a
Prelude.Nothing,
$sel:messageGroups:ResponseSpecification' :: NonEmpty MessageGroup
messageGroups = forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced forall t b. AReview t b -> b -> t
Lens.# NonEmpty MessageGroup
pMessageGroups_
}
responseSpecification_allowInterrupt :: Lens.Lens' ResponseSpecification (Prelude.Maybe Prelude.Bool)
responseSpecification_allowInterrupt :: Lens' ResponseSpecification (Maybe Bool)
responseSpecification_allowInterrupt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResponseSpecification' {Maybe Bool
allowInterrupt :: Maybe Bool
$sel:allowInterrupt:ResponseSpecification' :: ResponseSpecification -> Maybe Bool
allowInterrupt} -> Maybe Bool
allowInterrupt) (\s :: ResponseSpecification
s@ResponseSpecification' {} Maybe Bool
a -> ResponseSpecification
s {$sel:allowInterrupt:ResponseSpecification' :: Maybe Bool
allowInterrupt = Maybe Bool
a} :: ResponseSpecification)
responseSpecification_messageGroups :: Lens.Lens' ResponseSpecification (Prelude.NonEmpty MessageGroup)
responseSpecification_messageGroups :: Lens' ResponseSpecification (NonEmpty MessageGroup)
responseSpecification_messageGroups = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResponseSpecification' {NonEmpty MessageGroup
messageGroups :: NonEmpty MessageGroup
$sel:messageGroups:ResponseSpecification' :: ResponseSpecification -> NonEmpty MessageGroup
messageGroups} -> NonEmpty MessageGroup
messageGroups) (\s :: ResponseSpecification
s@ResponseSpecification' {} NonEmpty MessageGroup
a -> ResponseSpecification
s {$sel:messageGroups:ResponseSpecification' :: NonEmpty MessageGroup
messageGroups = NonEmpty MessageGroup
a} :: ResponseSpecification) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Data.FromJSON ResponseSpecification where
parseJSON :: Value -> Parser ResponseSpecification
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"ResponseSpecification"
( \Object
x ->
Maybe Bool -> NonEmpty MessageGroup -> ResponseSpecification
ResponseSpecification'
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
"allowInterrupt")
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
"messageGroups")
)
instance Prelude.Hashable ResponseSpecification where
hashWithSalt :: Int -> ResponseSpecification -> Int
hashWithSalt Int
_salt ResponseSpecification' {Maybe Bool
NonEmpty MessageGroup
messageGroups :: NonEmpty MessageGroup
allowInterrupt :: Maybe Bool
$sel:messageGroups:ResponseSpecification' :: ResponseSpecification -> NonEmpty MessageGroup
$sel:allowInterrupt:ResponseSpecification' :: ResponseSpecification -> Maybe Bool
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
allowInterrupt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty MessageGroup
messageGroups
instance Prelude.NFData ResponseSpecification where
rnf :: ResponseSpecification -> ()
rnf ResponseSpecification' {Maybe Bool
NonEmpty MessageGroup
messageGroups :: NonEmpty MessageGroup
allowInterrupt :: Maybe Bool
$sel:messageGroups:ResponseSpecification' :: ResponseSpecification -> NonEmpty MessageGroup
$sel:allowInterrupt:ResponseSpecification' :: ResponseSpecification -> Maybe Bool
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
allowInterrupt
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf NonEmpty MessageGroup
messageGroups
instance Data.ToJSON ResponseSpecification where
toJSON :: ResponseSpecification -> Value
toJSON ResponseSpecification' {Maybe Bool
NonEmpty MessageGroup
messageGroups :: NonEmpty MessageGroup
allowInterrupt :: Maybe Bool
$sel:messageGroups:ResponseSpecification' :: ResponseSpecification -> NonEmpty MessageGroup
$sel:allowInterrupt:ResponseSpecification' :: ResponseSpecification -> Maybe Bool
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"allowInterrupt" 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 Bool
allowInterrupt,
forall a. a -> Maybe a
Prelude.Just
(Key
"messageGroups" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty MessageGroup
messageGroups)
]
)