{-# 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.ManagedBlockChain.Types.ProposalActions where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.ManagedBlockChain.Types.InviteAction
import Amazonka.ManagedBlockChain.Types.RemoveAction
import qualified Amazonka.Prelude as Prelude
data ProposalActions = ProposalActions'
{
ProposalActions -> Maybe [InviteAction]
invitations :: Prelude.Maybe [InviteAction],
ProposalActions -> Maybe [RemoveAction]
removals :: Prelude.Maybe [RemoveAction]
}
deriving (ProposalActions -> ProposalActions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProposalActions -> ProposalActions -> Bool
$c/= :: ProposalActions -> ProposalActions -> Bool
== :: ProposalActions -> ProposalActions -> Bool
$c== :: ProposalActions -> ProposalActions -> Bool
Prelude.Eq, ReadPrec [ProposalActions]
ReadPrec ProposalActions
Int -> ReadS ProposalActions
ReadS [ProposalActions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProposalActions]
$creadListPrec :: ReadPrec [ProposalActions]
readPrec :: ReadPrec ProposalActions
$creadPrec :: ReadPrec ProposalActions
readList :: ReadS [ProposalActions]
$creadList :: ReadS [ProposalActions]
readsPrec :: Int -> ReadS ProposalActions
$creadsPrec :: Int -> ReadS ProposalActions
Prelude.Read, Int -> ProposalActions -> ShowS
[ProposalActions] -> ShowS
ProposalActions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProposalActions] -> ShowS
$cshowList :: [ProposalActions] -> ShowS
show :: ProposalActions -> String
$cshow :: ProposalActions -> String
showsPrec :: Int -> ProposalActions -> ShowS
$cshowsPrec :: Int -> ProposalActions -> ShowS
Prelude.Show, forall x. Rep ProposalActions x -> ProposalActions
forall x. ProposalActions -> Rep ProposalActions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ProposalActions x -> ProposalActions
$cfrom :: forall x. ProposalActions -> Rep ProposalActions x
Prelude.Generic)
newProposalActions ::
ProposalActions
newProposalActions :: ProposalActions
newProposalActions =
ProposalActions'
{ $sel:invitations:ProposalActions' :: Maybe [InviteAction]
invitations = forall a. Maybe a
Prelude.Nothing,
$sel:removals:ProposalActions' :: Maybe [RemoveAction]
removals = forall a. Maybe a
Prelude.Nothing
}
proposalActions_invitations :: Lens.Lens' ProposalActions (Prelude.Maybe [InviteAction])
proposalActions_invitations :: Lens' ProposalActions (Maybe [InviteAction])
proposalActions_invitations = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProposalActions' {Maybe [InviteAction]
invitations :: Maybe [InviteAction]
$sel:invitations:ProposalActions' :: ProposalActions -> Maybe [InviteAction]
invitations} -> Maybe [InviteAction]
invitations) (\s :: ProposalActions
s@ProposalActions' {} Maybe [InviteAction]
a -> ProposalActions
s {$sel:invitations:ProposalActions' :: Maybe [InviteAction]
invitations = Maybe [InviteAction]
a} :: ProposalActions) 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
proposalActions_removals :: Lens.Lens' ProposalActions (Prelude.Maybe [RemoveAction])
proposalActions_removals :: Lens' ProposalActions (Maybe [RemoveAction])
proposalActions_removals = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProposalActions' {Maybe [RemoveAction]
removals :: Maybe [RemoveAction]
$sel:removals:ProposalActions' :: ProposalActions -> Maybe [RemoveAction]
removals} -> Maybe [RemoveAction]
removals) (\s :: ProposalActions
s@ProposalActions' {} Maybe [RemoveAction]
a -> ProposalActions
s {$sel:removals:ProposalActions' :: Maybe [RemoveAction]
removals = Maybe [RemoveAction]
a} :: ProposalActions) 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 ProposalActions where
parseJSON :: Value -> Parser ProposalActions
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"ProposalActions"
( \Object
x ->
Maybe [InviteAction] -> Maybe [RemoveAction] -> ProposalActions
ProposalActions'
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
"Invitations" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
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
"Removals" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable ProposalActions where
hashWithSalt :: Int -> ProposalActions -> Int
hashWithSalt Int
_salt ProposalActions' {Maybe [InviteAction]
Maybe [RemoveAction]
removals :: Maybe [RemoveAction]
invitations :: Maybe [InviteAction]
$sel:removals:ProposalActions' :: ProposalActions -> Maybe [RemoveAction]
$sel:invitations:ProposalActions' :: ProposalActions -> Maybe [InviteAction]
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [InviteAction]
invitations
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [RemoveAction]
removals
instance Prelude.NFData ProposalActions where
rnf :: ProposalActions -> ()
rnf ProposalActions' {Maybe [InviteAction]
Maybe [RemoveAction]
removals :: Maybe [RemoveAction]
invitations :: Maybe [InviteAction]
$sel:removals:ProposalActions' :: ProposalActions -> Maybe [RemoveAction]
$sel:invitations:ProposalActions' :: ProposalActions -> Maybe [InviteAction]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [InviteAction]
invitations
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [RemoveAction]
removals
instance Data.ToJSON ProposalActions where
toJSON :: ProposalActions -> Value
toJSON ProposalActions' {Maybe [InviteAction]
Maybe [RemoveAction]
removals :: Maybe [RemoveAction]
invitations :: Maybe [InviteAction]
$sel:removals:ProposalActions' :: ProposalActions -> Maybe [RemoveAction]
$sel:invitations:ProposalActions' :: ProposalActions -> Maybe [InviteAction]
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"Invitations" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [InviteAction]
invitations,
(Key
"Removals" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [RemoveAction]
removals
]
)