{-# 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.Translate.Types.Term where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Term = Term'
{
Term -> Maybe Text
targetText :: Prelude.Maybe Prelude.Text,
Term -> Maybe Text
sourceText :: Prelude.Maybe Prelude.Text
}
deriving (Term -> Term -> Bool
(Term -> Term -> Bool) -> (Term -> Term -> Bool) -> Eq Term
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Term -> Term -> Bool
$c/= :: Term -> Term -> Bool
== :: Term -> Term -> Bool
$c== :: Term -> Term -> Bool
Prelude.Eq, ReadPrec [Term]
ReadPrec Term
Int -> ReadS Term
ReadS [Term]
(Int -> ReadS Term)
-> ReadS [Term] -> ReadPrec Term -> ReadPrec [Term] -> Read Term
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Term]
$creadListPrec :: ReadPrec [Term]
readPrec :: ReadPrec Term
$creadPrec :: ReadPrec Term
readList :: ReadS [Term]
$creadList :: ReadS [Term]
readsPrec :: Int -> ReadS Term
$creadsPrec :: Int -> ReadS Term
Prelude.Read, Int -> Term -> ShowS
[Term] -> ShowS
Term -> String
(Int -> Term -> ShowS)
-> (Term -> String) -> ([Term] -> ShowS) -> Show Term
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Term] -> ShowS
$cshowList :: [Term] -> ShowS
show :: Term -> String
$cshow :: Term -> String
showsPrec :: Int -> Term -> ShowS
$cshowsPrec :: Int -> Term -> ShowS
Prelude.Show, (forall x. Term -> Rep Term x)
-> (forall x. Rep Term x -> Term) -> Generic Term
forall x. Rep Term x -> Term
forall x. Term -> Rep Term x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Term x -> Term
$cfrom :: forall x. Term -> Rep Term x
Prelude.Generic)
newTerm ::
Term
newTerm :: Term
newTerm =
Term' :: Maybe Text -> Maybe Text -> Term
Term'
{ $sel:targetText:Term' :: Maybe Text
targetText = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:sourceText:Term' :: Maybe Text
sourceText = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
term_targetText :: Lens.Lens' Term (Prelude.Maybe Prelude.Text)
term_targetText :: (Maybe Text -> f (Maybe Text)) -> Term -> f Term
term_targetText = (Term -> Maybe Text)
-> (Term -> Maybe Text -> Term)
-> Lens Term Term (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Term' {Maybe Text
targetText :: Maybe Text
$sel:targetText:Term' :: Term -> Maybe Text
targetText} -> Maybe Text
targetText) (\s :: Term
s@Term' {} Maybe Text
a -> Term
s {$sel:targetText:Term' :: Maybe Text
targetText = Maybe Text
a} :: Term)
term_sourceText :: Lens.Lens' Term (Prelude.Maybe Prelude.Text)
term_sourceText :: (Maybe Text -> f (Maybe Text)) -> Term -> f Term
term_sourceText = (Term -> Maybe Text)
-> (Term -> Maybe Text -> Term)
-> Lens Term Term (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Term' {Maybe Text
sourceText :: Maybe Text
$sel:sourceText:Term' :: Term -> Maybe Text
sourceText} -> Maybe Text
sourceText) (\s :: Term
s@Term' {} Maybe Text
a -> Term
s {$sel:sourceText:Term' :: Maybe Text
sourceText = Maybe Text
a} :: Term)
instance Core.FromJSON Term where
parseJSON :: Value -> Parser Term
parseJSON =
String -> (Object -> Parser Term) -> Value -> Parser Term
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Term"
( \Object
x ->
Maybe Text -> Maybe Text -> Term
Term'
(Maybe Text -> Maybe Text -> Term)
-> Parser (Maybe Text) -> Parser (Maybe Text -> Term)
forall (f :: * -> *) a b. Functor 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
"TargetText")
Parser (Maybe Text -> Term) -> Parser (Maybe Text) -> Parser Term
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
"SourceText")
)
instance Prelude.Hashable Term
instance Prelude.NFData Term