{-# 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.MarketplaceCatalog.Types.Change where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MarketplaceCatalog.Types.Entity
import qualified Amazonka.Prelude as Prelude
data Change = Change'
{
Change -> Maybe Text
changeName :: Prelude.Maybe Prelude.Text,
Change -> Text
changeType :: Prelude.Text,
Change -> Entity
entity :: Entity,
Change -> Text
details :: Prelude.Text
}
deriving (Change -> Change -> Bool
(Change -> Change -> Bool)
-> (Change -> Change -> Bool) -> Eq Change
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Change -> Change -> Bool
$c/= :: Change -> Change -> Bool
== :: Change -> Change -> Bool
$c== :: Change -> Change -> Bool
Prelude.Eq, ReadPrec [Change]
ReadPrec Change
Int -> ReadS Change
ReadS [Change]
(Int -> ReadS Change)
-> ReadS [Change]
-> ReadPrec Change
-> ReadPrec [Change]
-> Read Change
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Change]
$creadListPrec :: ReadPrec [Change]
readPrec :: ReadPrec Change
$creadPrec :: ReadPrec Change
readList :: ReadS [Change]
$creadList :: ReadS [Change]
readsPrec :: Int -> ReadS Change
$creadsPrec :: Int -> ReadS Change
Prelude.Read, Int -> Change -> ShowS
[Change] -> ShowS
Change -> String
(Int -> Change -> ShowS)
-> (Change -> String) -> ([Change] -> ShowS) -> Show Change
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Change] -> ShowS
$cshowList :: [Change] -> ShowS
show :: Change -> String
$cshow :: Change -> String
showsPrec :: Int -> Change -> ShowS
$cshowsPrec :: Int -> Change -> ShowS
Prelude.Show, (forall x. Change -> Rep Change x)
-> (forall x. Rep Change x -> Change) -> Generic Change
forall x. Rep Change x -> Change
forall x. Change -> Rep Change x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Change x -> Change
$cfrom :: forall x. Change -> Rep Change x
Prelude.Generic)
newChange ::
Prelude.Text ->
Entity ->
Prelude.Text ->
Change
newChange :: Text -> Entity -> Text -> Change
newChange Text
pChangeType_ Entity
pEntity_ Text
pDetails_ =
Change' :: Maybe Text -> Text -> Entity -> Text -> Change
Change'
{ $sel:changeName:Change' :: Maybe Text
changeName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:changeType:Change' :: Text
changeType = Text
pChangeType_,
$sel:entity:Change' :: Entity
entity = Entity
pEntity_,
$sel:details:Change' :: Text
details = Text
pDetails_
}
change_changeName :: Lens.Lens' Change (Prelude.Maybe Prelude.Text)
change_changeName :: (Maybe Text -> f (Maybe Text)) -> Change -> f Change
change_changeName = (Change -> Maybe Text)
-> (Change -> Maybe Text -> Change)
-> Lens Change Change (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Change' {Maybe Text
changeName :: Maybe Text
$sel:changeName:Change' :: Change -> Maybe Text
changeName} -> Maybe Text
changeName) (\s :: Change
s@Change' {} Maybe Text
a -> Change
s {$sel:changeName:Change' :: Maybe Text
changeName = Maybe Text
a} :: Change)
change_changeType :: Lens.Lens' Change Prelude.Text
change_changeType :: (Text -> f Text) -> Change -> f Change
change_changeType = (Change -> Text)
-> (Change -> Text -> Change) -> Lens Change Change Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Change' {Text
changeType :: Text
$sel:changeType:Change' :: Change -> Text
changeType} -> Text
changeType) (\s :: Change
s@Change' {} Text
a -> Change
s {$sel:changeType:Change' :: Text
changeType = Text
a} :: Change)
change_entity :: Lens.Lens' Change Entity
change_entity :: (Entity -> f Entity) -> Change -> f Change
change_entity = (Change -> Entity)
-> (Change -> Entity -> Change) -> Lens Change Change Entity Entity
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Change' {Entity
entity :: Entity
$sel:entity:Change' :: Change -> Entity
entity} -> Entity
entity) (\s :: Change
s@Change' {} Entity
a -> Change
s {$sel:entity:Change' :: Entity
entity = Entity
a} :: Change)
change_details :: Lens.Lens' Change Prelude.Text
change_details :: (Text -> f Text) -> Change -> f Change
change_details = (Change -> Text)
-> (Change -> Text -> Change) -> Lens Change Change Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Change' {Text
details :: Text
$sel:details:Change' :: Change -> Text
details} -> Text
details) (\s :: Change
s@Change' {} Text
a -> Change
s {$sel:details:Change' :: Text
details = Text
a} :: Change)
instance Prelude.Hashable Change
instance Prelude.NFData Change
instance Core.ToJSON Change where
toJSON :: Change -> Value
toJSON Change' {Maybe Text
Text
Entity
details :: Text
entity :: Entity
changeType :: Text
changeName :: Maybe Text
$sel:details:Change' :: Change -> Text
$sel:entity:Change' :: Change -> Entity
$sel:changeType:Change' :: Change -> Text
$sel:changeName:Change' :: Change -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"ChangeName" 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
changeName,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ChangeType" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
changeType),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Entity" Text -> Entity -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Entity
entity),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Details" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
details)
]
)