{-# 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.EnumerationValue where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data EnumerationValue = EnumerationValue'
{
EnumerationValue -> Maybe [Text]
synonyms :: Prelude.Maybe [Prelude.Text],
EnumerationValue -> Text
value :: Prelude.Text
}
deriving (EnumerationValue -> EnumerationValue -> Bool
(EnumerationValue -> EnumerationValue -> Bool)
-> (EnumerationValue -> EnumerationValue -> Bool)
-> Eq EnumerationValue
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EnumerationValue -> EnumerationValue -> Bool
$c/= :: EnumerationValue -> EnumerationValue -> Bool
== :: EnumerationValue -> EnumerationValue -> Bool
$c== :: EnumerationValue -> EnumerationValue -> Bool
Prelude.Eq, ReadPrec [EnumerationValue]
ReadPrec EnumerationValue
Int -> ReadS EnumerationValue
ReadS [EnumerationValue]
(Int -> ReadS EnumerationValue)
-> ReadS [EnumerationValue]
-> ReadPrec EnumerationValue
-> ReadPrec [EnumerationValue]
-> Read EnumerationValue
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EnumerationValue]
$creadListPrec :: ReadPrec [EnumerationValue]
readPrec :: ReadPrec EnumerationValue
$creadPrec :: ReadPrec EnumerationValue
readList :: ReadS [EnumerationValue]
$creadList :: ReadS [EnumerationValue]
readsPrec :: Int -> ReadS EnumerationValue
$creadsPrec :: Int -> ReadS EnumerationValue
Prelude.Read, Int -> EnumerationValue -> ShowS
[EnumerationValue] -> ShowS
EnumerationValue -> String
(Int -> EnumerationValue -> ShowS)
-> (EnumerationValue -> String)
-> ([EnumerationValue] -> ShowS)
-> Show EnumerationValue
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EnumerationValue] -> ShowS
$cshowList :: [EnumerationValue] -> ShowS
show :: EnumerationValue -> String
$cshow :: EnumerationValue -> String
showsPrec :: Int -> EnumerationValue -> ShowS
$cshowsPrec :: Int -> EnumerationValue -> ShowS
Prelude.Show, (forall x. EnumerationValue -> Rep EnumerationValue x)
-> (forall x. Rep EnumerationValue x -> EnumerationValue)
-> Generic EnumerationValue
forall x. Rep EnumerationValue x -> EnumerationValue
forall x. EnumerationValue -> Rep EnumerationValue x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EnumerationValue x -> EnumerationValue
$cfrom :: forall x. EnumerationValue -> Rep EnumerationValue x
Prelude.Generic)
newEnumerationValue ::
Prelude.Text ->
EnumerationValue
newEnumerationValue :: Text -> EnumerationValue
newEnumerationValue Text
pValue_ =
EnumerationValue' :: Maybe [Text] -> Text -> EnumerationValue
EnumerationValue'
{ $sel:synonyms:EnumerationValue' :: Maybe [Text]
synonyms = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:value:EnumerationValue' :: Text
value = Text
pValue_
}
enumerationValue_synonyms :: Lens.Lens' EnumerationValue (Prelude.Maybe [Prelude.Text])
enumerationValue_synonyms :: (Maybe [Text] -> f (Maybe [Text]))
-> EnumerationValue -> f EnumerationValue
enumerationValue_synonyms = (EnumerationValue -> Maybe [Text])
-> (EnumerationValue -> Maybe [Text] -> EnumerationValue)
-> Lens
EnumerationValue EnumerationValue (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnumerationValue' {Maybe [Text]
synonyms :: Maybe [Text]
$sel:synonyms:EnumerationValue' :: EnumerationValue -> Maybe [Text]
synonyms} -> Maybe [Text]
synonyms) (\s :: EnumerationValue
s@EnumerationValue' {} Maybe [Text]
a -> EnumerationValue
s {$sel:synonyms:EnumerationValue' :: Maybe [Text]
synonyms = Maybe [Text]
a} :: EnumerationValue) ((Maybe [Text] -> f (Maybe [Text]))
-> EnumerationValue -> f EnumerationValue)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> EnumerationValue
-> f EnumerationValue
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
enumerationValue_value :: Lens.Lens' EnumerationValue Prelude.Text
enumerationValue_value :: (Text -> f Text) -> EnumerationValue -> f EnumerationValue
enumerationValue_value = (EnumerationValue -> Text)
-> (EnumerationValue -> Text -> EnumerationValue)
-> Lens EnumerationValue EnumerationValue Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnumerationValue' {Text
value :: Text
$sel:value:EnumerationValue' :: EnumerationValue -> Text
value} -> Text
value) (\s :: EnumerationValue
s@EnumerationValue' {} Text
a -> EnumerationValue
s {$sel:value:EnumerationValue' :: Text
value = Text
a} :: EnumerationValue)
instance Core.FromJSON EnumerationValue where
parseJSON :: Value -> Parser EnumerationValue
parseJSON =
String
-> (Object -> Parser EnumerationValue)
-> Value
-> Parser EnumerationValue
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"EnumerationValue"
( \Object
x ->
Maybe [Text] -> Text -> EnumerationValue
EnumerationValue'
(Maybe [Text] -> Text -> EnumerationValue)
-> Parser (Maybe [Text]) -> Parser (Text -> EnumerationValue)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"synonyms" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
Parser (Text -> EnumerationValue)
-> Parser Text -> Parser EnumerationValue
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"value")
)
instance Prelude.Hashable EnumerationValue
instance Prelude.NFData EnumerationValue
instance Core.ToJSON EnumerationValue where
toJSON :: EnumerationValue -> Value
toJSON EnumerationValue' {Maybe [Text]
Text
value :: Text
synonyms :: Maybe [Text]
$sel:value:EnumerationValue' :: EnumerationValue -> Text
$sel:synonyms:EnumerationValue' :: EnumerationValue -> Maybe [Text]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"synonyms" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Text] -> Pair) -> Maybe [Text] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
synonyms,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"value" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
value)
]
)