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

module Cardano.CLI.EraBased.Commands.StakeAddress
  ( StakeAddressCmds (..)
  , renderStakeAddressCmds
  )
where

import           Cardano.Api.Ledger (Coin)
import           Cardano.Api.Shelley

import           Cardano.CLI.Types.Common
import           Cardano.CLI.Types.Governance
import           Cardano.CLI.Types.Key

import           Prelude

import           Data.Text (Text)

data StakeAddressCmds era
  = StakeAddressKeyGenCmd
      KeyOutputFormat
      (VerificationKeyFile Out)
      (SigningKeyFile Out)
  | StakeAddressKeyHashCmd
      (VerificationKeyOrFile StakeKey)
      (Maybe (File () Out))
  | StakeAddressBuildCmd
      StakeVerifier
      NetworkId
      (Maybe (File () Out))
  | StakeAddressRegistrationCertificateCmd
      (ShelleyBasedEra era)
      StakeIdentifier
      (Maybe Coin)
      (File () Out)
  | StakeAddressStakeDelegationCertificateCmd
      (ShelleyBasedEra era)
      StakeIdentifier
      (VerificationKeyOrHashOrFile StakePoolKey)
      (File () Out)
  | StakeAddressStakeAndVoteDelegationCertificateCmd
      (ConwayEraOnwards era)
      StakeIdentifier
      (VerificationKeyOrHashOrFile StakePoolKey)
      VoteDelegationTarget
      (File () Out)
  | StakeAddressVoteDelegationCertificateCmd
      (ConwayEraOnwards era)
      StakeIdentifier
      VoteDelegationTarget
      (File () Out)
  | StakeAddressDeregistrationCertificateCmd
      (ShelleyBasedEra era)
      StakeIdentifier
      (Maybe Coin)
      (File () Out)
  | StakeAddressRegistrationAndDelegationCertificateCmd
      (ConwayEraOnwards era)
      StakeIdentifier
      (VerificationKeyOrHashOrFile StakePoolKey)
      Coin
      (File () Out)
  | StakeAddressRegistrationAndVoteDelegationCertificateCmd
      (ConwayEraOnwards era)
      StakeIdentifier
      VoteDelegationTarget
      Coin
      (File () Out)
  | StakeAddressRegistrationStakeAndVoteDelegationCertificateCmd
      (ConwayEraOnwards era)
      StakeIdentifier
      (VerificationKeyOrHashOrFile StakePoolKey)
      VoteDelegationTarget
      Coin
      (File () Out)
  deriving Int -> StakeAddressCmds era -> ShowS
[StakeAddressCmds era] -> ShowS
StakeAddressCmds era -> String
(Int -> StakeAddressCmds era -> ShowS)
-> (StakeAddressCmds era -> String)
-> ([StakeAddressCmds era] -> ShowS)
-> Show (StakeAddressCmds era)
forall era. Int -> StakeAddressCmds era -> ShowS
forall era. [StakeAddressCmds era] -> ShowS
forall era. StakeAddressCmds era -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall era. Int -> StakeAddressCmds era -> ShowS
showsPrec :: Int -> StakeAddressCmds era -> ShowS
$cshow :: forall era. StakeAddressCmds era -> String
show :: StakeAddressCmds era -> String
$cshowList :: forall era. [StakeAddressCmds era] -> ShowS
showList :: [StakeAddressCmds era] -> ShowS
Show

renderStakeAddressCmds :: StakeAddressCmds era -> Text
renderStakeAddressCmds :: forall era. StakeAddressCmds era -> Text
renderStakeAddressCmds = \case
  StakeAddressBuildCmd{} -> Text
"stake-address build"
  StakeAddressDeregistrationCertificateCmd{} -> Text
"stake-address deregistration-certificate"
  StakeAddressKeyGenCmd{} -> Text
"stake-address key-gen"
  StakeAddressKeyHashCmd{} -> Text
"stake-address key-hash"
  StakeAddressRegistrationCertificateCmd{} -> Text
"stake-address registration-certificate"
  StakeAddressStakeAndVoteDelegationCertificateCmd{} -> Text
"stake-address stake-and-vote-delegation-certificate"
  StakeAddressStakeDelegationCertificateCmd{} -> Text
"stake-address stake-delegation-certificate"
  StakeAddressVoteDelegationCertificateCmd{} -> Text
"stake-address vote-delegation-certificate"
  StakeAddressRegistrationAndDelegationCertificateCmd{} -> Text
"stake-address registration-and-stake-delegation-certificate"
  StakeAddressRegistrationAndVoteDelegationCertificateCmd{} -> Text
"stake-address registration-and-vote-delegation-certificate"
  StakeAddressRegistrationStakeAndVoteDelegationCertificateCmd{} -> Text
"stake-address registration-stake-and-vote-delegation-certificate"