{-# LANGUAGE FlexibleContexts #-}

module Cardano.Chain.Block.ValidationMode (
  BlockValidationMode (..),
  toTxValidationMode,
)
where

import Cardano.Chain.UTxO.ValidationMode (TxValidationMode (..))
import Cardano.Prelude

--------------------------------------------------------------------------------
-- BlockValidationMode
--------------------------------------------------------------------------------

-- | Indicates what sort of block validation should be performed.
data BlockValidationMode
  = -- | Perform all block validations.
    BlockValidation
  | -- | Perform no block validations.
    NoBlockValidation
  deriving (BlockValidationMode -> BlockValidationMode -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BlockValidationMode -> BlockValidationMode -> Bool
$c/= :: BlockValidationMode -> BlockValidationMode -> Bool
== :: BlockValidationMode -> BlockValidationMode -> Bool
$c== :: BlockValidationMode -> BlockValidationMode -> Bool
Eq, Int -> BlockValidationMode -> ShowS
[BlockValidationMode] -> ShowS
BlockValidationMode -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BlockValidationMode] -> ShowS
$cshowList :: [BlockValidationMode] -> ShowS
show :: BlockValidationMode -> String
$cshow :: BlockValidationMode -> String
showsPrec :: Int -> BlockValidationMode -> ShowS
$cshowsPrec :: Int -> BlockValidationMode -> ShowS
Show)

-- | Translate a 'BlockValidationMode' to an appropriate 'TxValidationMode'.
toTxValidationMode :: BlockValidationMode -> TxValidationMode
toTxValidationMode :: BlockValidationMode -> TxValidationMode
toTxValidationMode BlockValidationMode
BlockValidation = TxValidationMode
TxValidation
toTxValidationMode BlockValidationMode
NoBlockValidation = TxValidationMode
NoTxValidation