{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE UndecidableInstances #-}
{-# OPTIONS_GHC -Wno-orphans #-}

module Test.Cardano.Ledger.Conway.CanonicalState.Arbitrary () where

import Cardano.Ledger.CanonicalState.Conway (
  CanonicalGovActionState,
  fromGovActionState,
  mkCanonicalConstitution,
 )
import qualified Cardano.Ledger.CanonicalState.Namespace.GovConstitution.V0 as GovConstitution.V0
import qualified Cardano.Ledger.CanonicalState.Namespace.GovPParams.V0 as GovPParams.V0
import qualified Cardano.Ledger.CanonicalState.Namespace.GovProposals.V0 as GovProposals.V0
import Cardano.Ledger.Conway (ConwayEra)
import Cardano.Ledger.Conway.Governance (Constitution, GovActionState)
import Generic.Random (genericArbitraryU)
import Test.Cardano.Ledger.Conway.Arbitrary ()
import Test.QuickCheck (Arbitrary (..))

instance Arbitrary GovConstitution.V0.CanonicalConstitution where
  arbitrary :: Gen CanonicalConstitution
arbitrary = Constitution ConwayEra -> CanonicalConstitution
forall era. Constitution era -> CanonicalConstitution
mkCanonicalConstitution (Constitution ConwayEra -> CanonicalConstitution)
-> Gen (Constitution ConwayEra) -> Gen CanonicalConstitution
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. Arbitrary a => Gen a
arbitrary @(Constitution ConwayEra)

instance Arbitrary GovConstitution.V0.GovConstitutionOut where
  arbitrary :: Gen GovConstitutionOut
arbitrary = Gen GovConstitutionOut
forall a. (GArbitrary UnsizedOpts a, GUniformWeight a) => Gen a
genericArbitraryU

instance Arbitrary (GovPParams.V0.GovPParamsOut ConwayEra) where
  arbitrary :: Gen (GovPParamsOut ConwayEra)
arbitrary = Gen (GovPParamsOut ConwayEra)
forall a. (GArbitrary UnsizedOpts a, GUniformWeight a) => Gen a
genericArbitraryU

instance Arbitrary (GovProposals.V0.GovProposalOut CanonicalGovActionState) where
  arbitrary :: Gen (GovProposalOut CanonicalGovActionState)
arbitrary = (GovProposalIn, GovProposalOut CanonicalGovActionState)
-> GovProposalOut CanonicalGovActionState
forall a b. (a, b) -> b
snd ((GovProposalIn, GovProposalOut CanonicalGovActionState)
 -> GovProposalOut CanonicalGovActionState)
-> (GovActionState ConwayEra
    -> (GovProposalIn, GovProposalOut CanonicalGovActionState))
-> GovActionState ConwayEra
-> GovProposalOut CanonicalGovActionState
forall b c a. (b -> c) -> (a -> b) -> a -> c
. GovActionState ConwayEra
-> (GovProposalIn, GovProposalOut CanonicalGovActionState)
fromGovActionState (GovActionState ConwayEra
 -> GovProposalOut CanonicalGovActionState)
-> Gen (GovActionState ConwayEra)
-> Gen (GovProposalOut CanonicalGovActionState)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. Arbitrary a => Gen a
arbitrary @(GovActionState ConwayEra)