module Test.QuickCheck.ContractModel.Internal.Common (Era, LedgerEra, era) where

import Cardano.Api
import Cardano.Api.Shelley

type Era = BabbageEra
type LedgerEra = ShelleyLedgerEra Era

era :: ShelleyBasedEra Era
era :: ShelleyBasedEra Era
era = IsShelleyBasedEra Era => ShelleyBasedEra Era
forall era. IsShelleyBasedEra era => ShelleyBasedEra era
shelleyBasedEra @Era

-- TODO: remove once https://github.com/input-output-hk/cardano-node/pull/4528 has made it into all
--       dependencies
instance Ord (AddressInEra era) where
  compare :: AddressInEra era -> AddressInEra era -> Ordering
compare (AddressInEra AddressTypeInEra addrtype era
ByronAddressInAnyEra Address addrtype
addr1)
          (AddressInEra AddressTypeInEra addrtype era
ByronAddressInAnyEra Address addrtype
addr2) = Address addrtype -> Address addrtype -> Ordering
forall a. Ord a => a -> a -> Ordering
compare Address addrtype
addr1 Address addrtype
Address addrtype
addr2

  compare (AddressInEra ShelleyAddressInEra{} Address addrtype
addr1)
          (AddressInEra ShelleyAddressInEra{} Address addrtype
addr2) = Address addrtype -> Address addrtype -> Ordering
forall a. Ord a => a -> a -> Ordering
compare Address addrtype
addr1 Address addrtype
Address addrtype
addr2

  compare (AddressInEra AddressTypeInEra addrtype era
ByronAddressInAnyEra Address addrtype
_)
          (AddressInEra ShelleyAddressInEra{} Address addrtype
_) = Ordering
LT

  compare (AddressInEra ShelleyAddressInEra{} Address addrtype
_)
          (AddressInEra AddressTypeInEra addrtype era
ByronAddressInAnyEra Address addrtype
_) = Ordering
GT