{-# 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.CustomerProfiles.Types.ObjectTypeField where
import qualified Amazonka.Core as Core
import Amazonka.CustomerProfiles.Types.FieldContentType
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ObjectTypeField = ObjectTypeField'
{
ObjectTypeField -> Maybe Text
source :: Prelude.Maybe Prelude.Text,
ObjectTypeField -> Maybe FieldContentType
contentType :: Prelude.Maybe FieldContentType,
ObjectTypeField -> Maybe Text
target :: Prelude.Maybe Prelude.Text
}
deriving (ObjectTypeField -> ObjectTypeField -> Bool
(ObjectTypeField -> ObjectTypeField -> Bool)
-> (ObjectTypeField -> ObjectTypeField -> Bool)
-> Eq ObjectTypeField
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ObjectTypeField -> ObjectTypeField -> Bool
$c/= :: ObjectTypeField -> ObjectTypeField -> Bool
== :: ObjectTypeField -> ObjectTypeField -> Bool
$c== :: ObjectTypeField -> ObjectTypeField -> Bool
Prelude.Eq, ReadPrec [ObjectTypeField]
ReadPrec ObjectTypeField
Int -> ReadS ObjectTypeField
ReadS [ObjectTypeField]
(Int -> ReadS ObjectTypeField)
-> ReadS [ObjectTypeField]
-> ReadPrec ObjectTypeField
-> ReadPrec [ObjectTypeField]
-> Read ObjectTypeField
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ObjectTypeField]
$creadListPrec :: ReadPrec [ObjectTypeField]
readPrec :: ReadPrec ObjectTypeField
$creadPrec :: ReadPrec ObjectTypeField
readList :: ReadS [ObjectTypeField]
$creadList :: ReadS [ObjectTypeField]
readsPrec :: Int -> ReadS ObjectTypeField
$creadsPrec :: Int -> ReadS ObjectTypeField
Prelude.Read, Int -> ObjectTypeField -> ShowS
[ObjectTypeField] -> ShowS
ObjectTypeField -> String
(Int -> ObjectTypeField -> ShowS)
-> (ObjectTypeField -> String)
-> ([ObjectTypeField] -> ShowS)
-> Show ObjectTypeField
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ObjectTypeField] -> ShowS
$cshowList :: [ObjectTypeField] -> ShowS
show :: ObjectTypeField -> String
$cshow :: ObjectTypeField -> String
showsPrec :: Int -> ObjectTypeField -> ShowS
$cshowsPrec :: Int -> ObjectTypeField -> ShowS
Prelude.Show, (forall x. ObjectTypeField -> Rep ObjectTypeField x)
-> (forall x. Rep ObjectTypeField x -> ObjectTypeField)
-> Generic ObjectTypeField
forall x. Rep ObjectTypeField x -> ObjectTypeField
forall x. ObjectTypeField -> Rep ObjectTypeField x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ObjectTypeField x -> ObjectTypeField
$cfrom :: forall x. ObjectTypeField -> Rep ObjectTypeField x
Prelude.Generic)
newObjectTypeField ::
ObjectTypeField
newObjectTypeField :: ObjectTypeField
newObjectTypeField =
ObjectTypeField' :: Maybe Text
-> Maybe FieldContentType -> Maybe Text -> ObjectTypeField
ObjectTypeField'
{ $sel:source:ObjectTypeField' :: Maybe Text
source = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:contentType:ObjectTypeField' :: Maybe FieldContentType
contentType = Maybe FieldContentType
forall a. Maybe a
Prelude.Nothing,
$sel:target:ObjectTypeField' :: Maybe Text
target = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
objectTypeField_source :: Lens.Lens' ObjectTypeField (Prelude.Maybe Prelude.Text)
objectTypeField_source :: (Maybe Text -> f (Maybe Text))
-> ObjectTypeField -> f ObjectTypeField
objectTypeField_source = (ObjectTypeField -> Maybe Text)
-> (ObjectTypeField -> Maybe Text -> ObjectTypeField)
-> Lens ObjectTypeField ObjectTypeField (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ObjectTypeField' {Maybe Text
source :: Maybe Text
$sel:source:ObjectTypeField' :: ObjectTypeField -> Maybe Text
source} -> Maybe Text
source) (\s :: ObjectTypeField
s@ObjectTypeField' {} Maybe Text
a -> ObjectTypeField
s {$sel:source:ObjectTypeField' :: Maybe Text
source = Maybe Text
a} :: ObjectTypeField)
objectTypeField_contentType :: Lens.Lens' ObjectTypeField (Prelude.Maybe FieldContentType)
objectTypeField_contentType :: (Maybe FieldContentType -> f (Maybe FieldContentType))
-> ObjectTypeField -> f ObjectTypeField
objectTypeField_contentType = (ObjectTypeField -> Maybe FieldContentType)
-> (ObjectTypeField -> Maybe FieldContentType -> ObjectTypeField)
-> Lens
ObjectTypeField
ObjectTypeField
(Maybe FieldContentType)
(Maybe FieldContentType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ObjectTypeField' {Maybe FieldContentType
contentType :: Maybe FieldContentType
$sel:contentType:ObjectTypeField' :: ObjectTypeField -> Maybe FieldContentType
contentType} -> Maybe FieldContentType
contentType) (\s :: ObjectTypeField
s@ObjectTypeField' {} Maybe FieldContentType
a -> ObjectTypeField
s {$sel:contentType:ObjectTypeField' :: Maybe FieldContentType
contentType = Maybe FieldContentType
a} :: ObjectTypeField)
objectTypeField_target :: Lens.Lens' ObjectTypeField (Prelude.Maybe Prelude.Text)
objectTypeField_target :: (Maybe Text -> f (Maybe Text))
-> ObjectTypeField -> f ObjectTypeField
objectTypeField_target = (ObjectTypeField -> Maybe Text)
-> (ObjectTypeField -> Maybe Text -> ObjectTypeField)
-> Lens ObjectTypeField ObjectTypeField (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ObjectTypeField' {Maybe Text
target :: Maybe Text
$sel:target:ObjectTypeField' :: ObjectTypeField -> Maybe Text
target} -> Maybe Text
target) (\s :: ObjectTypeField
s@ObjectTypeField' {} Maybe Text
a -> ObjectTypeField
s {$sel:target:ObjectTypeField' :: Maybe Text
target = Maybe Text
a} :: ObjectTypeField)
instance Core.FromJSON ObjectTypeField where
parseJSON :: Value -> Parser ObjectTypeField
parseJSON =
String
-> (Object -> Parser ObjectTypeField)
-> Value
-> Parser ObjectTypeField
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ObjectTypeField"
( \Object
x ->
Maybe Text
-> Maybe FieldContentType -> Maybe Text -> ObjectTypeField
ObjectTypeField'
(Maybe Text
-> Maybe FieldContentType -> Maybe Text -> ObjectTypeField)
-> Parser (Maybe Text)
-> Parser (Maybe FieldContentType -> Maybe Text -> ObjectTypeField)
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
"Source")
Parser (Maybe FieldContentType -> Maybe Text -> ObjectTypeField)
-> Parser (Maybe FieldContentType)
-> Parser (Maybe Text -> ObjectTypeField)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe FieldContentType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ContentType")
Parser (Maybe Text -> ObjectTypeField)
-> Parser (Maybe Text) -> Parser ObjectTypeField
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
"Target")
)
instance Prelude.Hashable ObjectTypeField
instance Prelude.NFData ObjectTypeField
instance Core.ToJSON ObjectTypeField where
toJSON :: ObjectTypeField -> Value
toJSON ObjectTypeField' {Maybe Text
Maybe FieldContentType
target :: Maybe Text
contentType :: Maybe FieldContentType
source :: Maybe Text
$sel:target:ObjectTypeField' :: ObjectTypeField -> Maybe Text
$sel:contentType:ObjectTypeField' :: ObjectTypeField -> Maybe FieldContentType
$sel:source:ObjectTypeField' :: ObjectTypeField -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Source" 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
source,
(Text
"ContentType" Text -> FieldContentType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (FieldContentType -> Pair) -> Maybe FieldContentType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe FieldContentType
contentType,
(Text
"Target" 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
target
]
)