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