{-# LANGUAGE DataKinds #-}
{-# LANGUAGE LambdaCase #-}

module Cardano.CLI.Legacy.Commands.Genesis
  ( LegacyGenesisCmds (..)
  , renderLegacyGenesisCmds
  )
where

import qualified Cardano.Api.Byron as Byron
import           Cardano.Api.Ledger (Coin)
import           Cardano.Api.Shelley

import           Cardano.CLI.Types.Common

import           Data.Text (Text)

data LegacyGenesisCmds
  = GenesisCreate
      (EraInEon ShelleyBasedEra)
      KeyOutputFormat
      GenesisDir
      Word
      Word
      (Maybe SystemStart)
      (Maybe Coin)
      NetworkId
  | GenesisCreateCardano
      (EraInEon ShelleyBasedEra)
      GenesisDir
      Word
      Word
      (Maybe SystemStart)
      (Maybe Coin)
      Byron.BlockCount
      Word
      Rational
      NetworkId
      FilePath
      FilePath
      FilePath
      FilePath
      (Maybe FilePath)
  | -- | Relay specification filepath
    GenesisCreateStaked
      (EraInEon ShelleyBasedEra)
      KeyOutputFormat
      GenesisDir
      Word
      Word
      Word
      Word
      (Maybe SystemStart)
      (Maybe Coin)
      Coin
      NetworkId
      Word
      Word
      Word
      (Maybe FilePath)
  | GenesisKeyGenGenesis
      (VerificationKeyFile Out)
      (SigningKeyFile Out)
  | GenesisKeyGenDelegate
      (VerificationKeyFile Out)
      (SigningKeyFile Out)
      (OpCertCounterFile Out)
  | GenesisKeyGenUTxO
      (VerificationKeyFile Out)
      (SigningKeyFile Out)
  | GenesisCmdKeyHash
      (VerificationKeyFile In)
  | GenesisVerKey
      (VerificationKeyFile Out)
      (SigningKeyFile In)
  | GenesisTxIn
      (VerificationKeyFile In)
      NetworkId
      (Maybe (File () Out))
  | GenesisAddr
      (VerificationKeyFile In)
      NetworkId
      (Maybe (File () Out))
  | GenesisHashFile
      GenesisFile
  deriving Int -> LegacyGenesisCmds -> ShowS
[LegacyGenesisCmds] -> ShowS
LegacyGenesisCmds -> String
(Int -> LegacyGenesisCmds -> ShowS)
-> (LegacyGenesisCmds -> String)
-> ([LegacyGenesisCmds] -> ShowS)
-> Show LegacyGenesisCmds
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> LegacyGenesisCmds -> ShowS
showsPrec :: Int -> LegacyGenesisCmds -> ShowS
$cshow :: LegacyGenesisCmds -> String
show :: LegacyGenesisCmds -> String
$cshowList :: [LegacyGenesisCmds] -> ShowS
showList :: [LegacyGenesisCmds] -> ShowS
Show

renderLegacyGenesisCmds :: LegacyGenesisCmds -> Text
renderLegacyGenesisCmds :: LegacyGenesisCmds -> Text
renderLegacyGenesisCmds = \case
  GenesisCreate{} -> Text
"genesis create"
  GenesisCreateCardano{} -> Text
"genesis create-cardano"
  GenesisCreateStaked{} -> Text
"genesis create-staked"
  GenesisKeyGenGenesis{} -> Text
"genesis key-gen-genesis"
  GenesisKeyGenDelegate{} -> Text
"genesis key-gen-delegate"
  GenesisKeyGenUTxO{} -> Text
"genesis key-gen-utxo"
  GenesisCmdKeyHash{} -> Text
"genesis key-hash"
  GenesisVerKey{} -> Text
"genesis get-ver-key"
  GenesisTxIn{} -> Text
"genesis initial-txin"
  GenesisAddr{} -> Text
"genesis initial-addr"
  GenesisHashFile{} -> Text
"genesis hash"