module Test.Cardano.Chain.MempoolPayload.Gen (
  genMempoolPayload,
)
where

import Cardano.Chain.MempoolPayload (AMempoolPayload (..), MempoolPayload)
import Cardano.Crypto (ProtocolMagicId)
import Cardano.Prelude
import Hedgehog
import qualified Hedgehog.Gen as Gen
import Test.Cardano.Chain.Delegation.Gen as Delegation (genCertificate)
import Test.Cardano.Chain.UTxO.Gen (genTxAux)
import Test.Cardano.Chain.Update.Gen as Update (genProposal, genVote)

genMempoolPayload :: ProtocolMagicId -> Gen MempoolPayload
genMempoolPayload :: ProtocolMagicId -> Gen MempoolPayload
genMempoolPayload ProtocolMagicId
pmi =
  forall (m :: * -> *) a. MonadGen m => [m a] -> m a
Gen.choice
    [ forall a. ATxAux a -> AMempoolPayload a
MempoolTx forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ProtocolMagicId -> Gen TxAux
genTxAux ProtocolMagicId
pmi
    , forall a. ACertificate a -> AMempoolPayload a
MempoolDlg forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ProtocolMagicId -> Gen Certificate
Delegation.genCertificate ProtocolMagicId
pmi
    , forall a. AProposal a -> AMempoolPayload a
MempoolUpdateProposal forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ProtocolMagicId -> Gen Proposal
Update.genProposal ProtocolMagicId
pmi
    , forall a. AVote a -> AMempoolPayload a
MempoolUpdateVote forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ProtocolMagicId -> Gen Vote
Update.genVote ProtocolMagicId
pmi
    ]