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