{-# 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.AppliedTerminology where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.Translate.Types.Term
data AppliedTerminology = AppliedTerminology'
{
AppliedTerminology -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
AppliedTerminology -> Maybe [Term]
terms :: Prelude.Maybe [Term]
}
deriving (AppliedTerminology -> AppliedTerminology -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AppliedTerminology -> AppliedTerminology -> Bool
$c/= :: AppliedTerminology -> AppliedTerminology -> Bool
== :: AppliedTerminology -> AppliedTerminology -> Bool
$c== :: AppliedTerminology -> AppliedTerminology -> Bool
Prelude.Eq, ReadPrec [AppliedTerminology]
ReadPrec AppliedTerminology
Int -> ReadS AppliedTerminology
ReadS [AppliedTerminology]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AppliedTerminology]
$creadListPrec :: ReadPrec [AppliedTerminology]
readPrec :: ReadPrec AppliedTerminology
$creadPrec :: ReadPrec AppliedTerminology
readList :: ReadS [AppliedTerminology]
$creadList :: ReadS [AppliedTerminology]
readsPrec :: Int -> ReadS AppliedTerminology
$creadsPrec :: Int -> ReadS AppliedTerminology
Prelude.Read, Int -> AppliedTerminology -> ShowS
[AppliedTerminology] -> ShowS
AppliedTerminology -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AppliedTerminology] -> ShowS
$cshowList :: [AppliedTerminology] -> ShowS
show :: AppliedTerminology -> String
$cshow :: AppliedTerminology -> String
showsPrec :: Int -> AppliedTerminology -> ShowS
$cshowsPrec :: Int -> AppliedTerminology -> ShowS
Prelude.Show, forall x. Rep AppliedTerminology x -> AppliedTerminology
forall x. AppliedTerminology -> Rep AppliedTerminology x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AppliedTerminology x -> AppliedTerminology
$cfrom :: forall x. AppliedTerminology -> Rep AppliedTerminology x
Prelude.Generic)
newAppliedTerminology ::
AppliedTerminology
newAppliedTerminology :: AppliedTerminology
newAppliedTerminology =
AppliedTerminology'
{ $sel:name:AppliedTerminology' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
$sel:terms:AppliedTerminology' :: Maybe [Term]
terms = forall a. Maybe a
Prelude.Nothing
}
appliedTerminology_name :: Lens.Lens' AppliedTerminology (Prelude.Maybe Prelude.Text)
appliedTerminology_name :: Lens' AppliedTerminology (Maybe Text)
appliedTerminology_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AppliedTerminology' {Maybe Text
name :: Maybe Text
$sel:name:AppliedTerminology' :: AppliedTerminology -> Maybe Text
name} -> Maybe Text
name) (\s :: AppliedTerminology
s@AppliedTerminology' {} Maybe Text
a -> AppliedTerminology
s {$sel:name:AppliedTerminology' :: Maybe Text
name = Maybe Text
a} :: AppliedTerminology)
appliedTerminology_terms :: Lens.Lens' AppliedTerminology (Prelude.Maybe [Term])
appliedTerminology_terms :: Lens' AppliedTerminology (Maybe [Term])
appliedTerminology_terms = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AppliedTerminology' {Maybe [Term]
terms :: Maybe [Term]
$sel:terms:AppliedTerminology' :: AppliedTerminology -> Maybe [Term]
terms} -> Maybe [Term]
terms) (\s :: AppliedTerminology
s@AppliedTerminology' {} Maybe [Term]
a -> AppliedTerminology
s {$sel:terms:AppliedTerminology' :: Maybe [Term]
terms = Maybe [Term]
a} :: AppliedTerminology) 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
instance Data.FromJSON AppliedTerminology where
parseJSON :: Value -> Parser AppliedTerminology
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"AppliedTerminology"
( \Object
x ->
Maybe Text -> Maybe [Term] -> AppliedTerminology
AppliedTerminology'
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
"Name")
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
"Terms" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable AppliedTerminology where
hashWithSalt :: Int -> AppliedTerminology -> Int
hashWithSalt Int
_salt AppliedTerminology' {Maybe [Term]
Maybe Text
terms :: Maybe [Term]
name :: Maybe Text
$sel:terms:AppliedTerminology' :: AppliedTerminology -> Maybe [Term]
$sel:name:AppliedTerminology' :: AppliedTerminology -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Term]
terms
instance Prelude.NFData AppliedTerminology where
rnf :: AppliedTerminology -> ()
rnf AppliedTerminology' {Maybe [Term]
Maybe Text
terms :: Maybe [Term]
name :: Maybe Text
$sel:terms:AppliedTerminology' :: AppliedTerminology -> Maybe [Term]
$sel:name:AppliedTerminology' :: AppliedTerminology -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Term]
terms