{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE ScopedTypeVariables #-}

module Cardano.CLI.Types.Errors.StakeAddressDelegationError
  ( StakeAddressDelegationError (..)
  )
where

import           Cardano.Api

newtype StakeAddressDelegationError = VoteDelegationNotSupported (EraInEon ShelleyToBabbageEra)
  deriving Int -> StakeAddressDelegationError -> ShowS
[StakeAddressDelegationError] -> ShowS
StakeAddressDelegationError -> String
(Int -> StakeAddressDelegationError -> ShowS)
-> (StakeAddressDelegationError -> String)
-> ([StakeAddressDelegationError] -> ShowS)
-> Show StakeAddressDelegationError
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> StakeAddressDelegationError -> ShowS
showsPrec :: Int -> StakeAddressDelegationError -> ShowS
$cshow :: StakeAddressDelegationError -> String
show :: StakeAddressDelegationError -> String
$cshowList :: [StakeAddressDelegationError] -> ShowS
showList :: [StakeAddressDelegationError] -> ShowS
Show

instance Error StakeAddressDelegationError where
  prettyError :: forall ann. StakeAddressDelegationError -> Doc ann
prettyError = \case
    VoteDelegationNotSupported (EraInEon ShelleyToBabbageEra era
eraInEon) -> Doc ann
"Vote delegation not supported in " Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> CardanoEra era -> Doc ann
forall a ann. Pretty a => a -> Doc ann
forall ann. CardanoEra era -> Doc ann
pretty (ShelleyToBabbageEra era -> CardanoEra era
forall era. ShelleyToBabbageEra era -> CardanoEra era
forall (eon :: * -> *) era.
ToCardanoEra eon =>
eon era -> CardanoEra era
toCardanoEra ShelleyToBabbageEra era
eraInEon) Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> Doc ann
" era."