module Cardano.CLI.Types.Errors.BootstrapWitnessError
  ( BootstrapWitnessError (..)
  , renderBootstrapWitnessError
  )
where

import           Prettyprinter

-- | Error constructing a Shelley bootstrap witness (i.e. a Byron key witness
-- in the Shelley era).
data BootstrapWitnessError
  = -- | Neither a network ID nor a Byron address were provided to construct the
    -- Shelley bootstrap witness. One or the other is required.
    MissingNetworkIdOrByronAddressError
  deriving Int -> BootstrapWitnessError -> ShowS
[BootstrapWitnessError] -> ShowS
BootstrapWitnessError -> String
(Int -> BootstrapWitnessError -> ShowS)
-> (BootstrapWitnessError -> String)
-> ([BootstrapWitnessError] -> ShowS)
-> Show BootstrapWitnessError
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BootstrapWitnessError -> ShowS
showsPrec :: Int -> BootstrapWitnessError -> ShowS
$cshow :: BootstrapWitnessError -> String
show :: BootstrapWitnessError -> String
$cshowList :: [BootstrapWitnessError] -> ShowS
showList :: [BootstrapWitnessError] -> ShowS
Show

-- | Render an error message for a 'BootstrapWitnessError'.
renderBootstrapWitnessError :: BootstrapWitnessError -> Doc ann
renderBootstrapWitnessError :: forall ann. BootstrapWitnessError -> Doc ann
renderBootstrapWitnessError BootstrapWitnessError
MissingNetworkIdOrByronAddressError =
  Doc ann
"Transactions witnessed by a Byron signing key must be accompanied by a "
    Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> Doc ann
"network ID. Either provide a network ID or provide a Byron "
    Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> Doc ann
"address with each Byron signing key (network IDs can be derived "
    Doc ann -> Doc ann -> Doc ann
forall a. Semigroup a => a -> a -> a
<> Doc ann
"from Byron addresses)."