{-# LANGUAGE LambdaCase #-}

module Cardano.CLI.Types.TxFeature
  ( TxFeature (..)
  , renderFeature
  )
where

import           Data.Text (Text)

-- | An enumeration of era-dependent features where we have to check that it
-- is permissible to use this feature in this era.
data TxFeature
  = TxFeatureShelleyAddresses
  | TxFeatureExplicitFees
  | TxFeatureImplicitFees
  | TxFeatureValidityLowerBound
  | TxFeatureValidityUpperBound
  | TxFeatureValidityNoUpperBound
  | TxFeatureTxMetadata
  | TxFeatureAuxScripts
  | TxFeatureWithdrawals
  | TxFeatureCertificates
  | TxFeatureMintValue
  | TxFeatureMultiAssetOutputs
  | TxFeatureScriptWitnesses
  | TxFeatureShelleyKeys
  | TxFeatureCollateral
  | TxFeatureProtocolParameters
  | TxFeatureTxOutDatum
  | TxFeatureScriptValidity
  | TxFeatureExtraKeyWits
  | TxFeatureInlineDatums
  | TxFeatureTotalCollateral
  | TxFeatureReferenceInputs
  | TxFeatureReturnCollateral
  deriving Int -> TxFeature -> ShowS
[TxFeature] -> ShowS
TxFeature -> String
(Int -> TxFeature -> ShowS)
-> (TxFeature -> String)
-> ([TxFeature] -> ShowS)
-> Show TxFeature
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TxFeature -> ShowS
showsPrec :: Int -> TxFeature -> ShowS
$cshow :: TxFeature -> String
show :: TxFeature -> String
$cshowList :: [TxFeature] -> ShowS
showList :: [TxFeature] -> ShowS
Show

renderFeature :: TxFeature -> Text
renderFeature :: TxFeature -> Text
renderFeature = \case
  TxFeature
TxFeatureShelleyAddresses -> Text
"Shelley addresses"
  TxFeature
TxFeatureExplicitFees -> Text
"Explicit fees"
  TxFeature
TxFeatureImplicitFees -> Text
"Implicit fees"
  TxFeature
TxFeatureValidityLowerBound -> Text
"A validity lower bound"
  TxFeature
TxFeatureValidityUpperBound -> Text
"A validity upper bound"
  TxFeature
TxFeatureValidityNoUpperBound -> Text
"An absent validity upper bound"
  TxFeature
TxFeatureTxMetadata -> Text
"Transaction metadata"
  TxFeature
TxFeatureAuxScripts -> Text
"Auxiliary scripts"
  TxFeature
TxFeatureWithdrawals -> Text
"Reward account withdrawals"
  TxFeature
TxFeatureCertificates -> Text
"Certificates"
  TxFeature
TxFeatureMintValue -> Text
"Asset minting"
  TxFeature
TxFeatureMultiAssetOutputs -> Text
"Multi-Asset outputs"
  TxFeature
TxFeatureScriptWitnesses -> Text
"Script witnesses"
  TxFeature
TxFeatureShelleyKeys -> Text
"Shelley keys"
  TxFeature
TxFeatureCollateral -> Text
"Collateral inputs"
  TxFeature
TxFeatureProtocolParameters -> Text
"Protocol parameters"
  TxFeature
TxFeatureTxOutDatum -> Text
"Transaction output datums"
  TxFeature
TxFeatureScriptValidity -> Text
"Script validity"
  TxFeature
TxFeatureExtraKeyWits -> Text
"Required signers"
  TxFeature
TxFeatureInlineDatums -> Text
"Inline datums"
  TxFeature
TxFeatureTotalCollateral -> Text
"Total collateral"
  TxFeature
TxFeatureReferenceInputs -> Text
"Reference inputs"
  TxFeature
TxFeatureReturnCollateral -> Text
"Return collateral"