{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric  #-}

module Ouroboros.Consensus.HardFork.Simple (TriggerHardFork (..)) where

import           Data.Word
import           GHC.Generics (Generic)
import           NoThunks.Class (NoThunks)

import           Cardano.Slotting.Slot (EpochNo)

-- | The trigger condition that will cause the hard fork transition.
data TriggerHardFork =
    -- | Trigger the transition when the on-chain protocol major version (from
    -- the ledger state) reaches this number.
    TriggerHardForkAtVersion !Word16
    -- | For testing only, trigger the transition at a specific hard-coded
    -- epoch, irrespective of the ledger state.
  | TriggerHardForkAtEpoch !EpochNo
    -- | Never trigger a hard fork
  | TriggerHardForkNever
  deriving (Int -> TriggerHardFork -> ShowS
[TriggerHardFork] -> ShowS
TriggerHardFork -> String
(Int -> TriggerHardFork -> ShowS)
-> (TriggerHardFork -> String)
-> ([TriggerHardFork] -> ShowS)
-> Show TriggerHardFork
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TriggerHardFork] -> ShowS
$cshowList :: [TriggerHardFork] -> ShowS
show :: TriggerHardFork -> String
$cshow :: TriggerHardFork -> String
showsPrec :: Int -> TriggerHardFork -> ShowS
$cshowsPrec :: Int -> TriggerHardFork -> ShowS
Show, (forall x. TriggerHardFork -> Rep TriggerHardFork x)
-> (forall x. Rep TriggerHardFork x -> TriggerHardFork)
-> Generic TriggerHardFork
forall x. Rep TriggerHardFork x -> TriggerHardFork
forall x. TriggerHardFork -> Rep TriggerHardFork x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TriggerHardFork x -> TriggerHardFork
$cfrom :: forall x. TriggerHardFork -> Rep TriggerHardFork x
Generic, Context -> TriggerHardFork -> IO (Maybe ThunkInfo)
Proxy TriggerHardFork -> String
(Context -> TriggerHardFork -> IO (Maybe ThunkInfo))
-> (Context -> TriggerHardFork -> IO (Maybe ThunkInfo))
-> (Proxy TriggerHardFork -> String)
-> NoThunks TriggerHardFork
forall a.
(Context -> a -> IO (Maybe ThunkInfo))
-> (Context -> a -> IO (Maybe ThunkInfo))
-> (Proxy a -> String)
-> NoThunks a
showTypeOf :: Proxy TriggerHardFork -> String
$cshowTypeOf :: Proxy TriggerHardFork -> String
wNoThunks :: Context -> TriggerHardFork -> IO (Maybe ThunkInfo)
$cwNoThunks :: Context -> TriggerHardFork -> IO (Maybe ThunkInfo)
noThunks :: Context -> TriggerHardFork -> IO (Maybe ThunkInfo)
$cnoThunks :: Context -> TriggerHardFork -> IO (Maybe ThunkInfo)
NoThunks)