{-# LANGUAGE DataKinds #-}

module Cardano.CLI.Types.Key.VerificationKey
  ( AnyVerificationKeySource (..)
  , AnyVerificationKeyText (..)
  )
where

import           Cardano.Api

import           Data.Text (Text)

-- | A bech32 text encoded verification key of an unspecified key role.
newtype AnyVerificationKeyText = AnyVerificationKeyText
  { AnyVerificationKeyText -> Text
unAnyVerificationKeyText :: Text
  }
  deriving (AnyVerificationKeyText -> AnyVerificationKeyText -> Bool
(AnyVerificationKeyText -> AnyVerificationKeyText -> Bool)
-> (AnyVerificationKeyText -> AnyVerificationKeyText -> Bool)
-> Eq AnyVerificationKeyText
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: AnyVerificationKeyText -> AnyVerificationKeyText -> Bool
== :: AnyVerificationKeyText -> AnyVerificationKeyText -> Bool
$c/= :: AnyVerificationKeyText -> AnyVerificationKeyText -> Bool
/= :: AnyVerificationKeyText -> AnyVerificationKeyText -> Bool
Eq, Int -> AnyVerificationKeyText -> ShowS
[AnyVerificationKeyText] -> ShowS
AnyVerificationKeyText -> String
(Int -> AnyVerificationKeyText -> ShowS)
-> (AnyVerificationKeyText -> String)
-> ([AnyVerificationKeyText] -> ShowS)
-> Show AnyVerificationKeyText
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> AnyVerificationKeyText -> ShowS
showsPrec :: Int -> AnyVerificationKeyText -> ShowS
$cshow :: AnyVerificationKeyText -> String
show :: AnyVerificationKeyText -> String
$cshowList :: [AnyVerificationKeyText] -> ShowS
showList :: [AnyVerificationKeyText] -> ShowS
Show)

-- | The source from which a verification key of an unspecified key role can be
-- derived.
data AnyVerificationKeySource
  = AnyVerificationKeySourceOfText !AnyVerificationKeyText
  | AnyVerificationKeySourceOfFile !(File (VerificationKey ()) In)
  deriving (AnyVerificationKeySource -> AnyVerificationKeySource -> Bool
(AnyVerificationKeySource -> AnyVerificationKeySource -> Bool)
-> (AnyVerificationKeySource -> AnyVerificationKeySource -> Bool)
-> Eq AnyVerificationKeySource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: AnyVerificationKeySource -> AnyVerificationKeySource -> Bool
== :: AnyVerificationKeySource -> AnyVerificationKeySource -> Bool
$c/= :: AnyVerificationKeySource -> AnyVerificationKeySource -> Bool
/= :: AnyVerificationKeySource -> AnyVerificationKeySource -> Bool
Eq, Int -> AnyVerificationKeySource -> ShowS
[AnyVerificationKeySource] -> ShowS
AnyVerificationKeySource -> String
(Int -> AnyVerificationKeySource -> ShowS)
-> (AnyVerificationKeySource -> String)
-> ([AnyVerificationKeySource] -> ShowS)
-> Show AnyVerificationKeySource
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> AnyVerificationKeySource -> ShowS
showsPrec :: Int -> AnyVerificationKeySource -> ShowS
$cshow :: AnyVerificationKeySource -> String
show :: AnyVerificationKeySource -> String
$cshowList :: [AnyVerificationKeySource] -> ShowS
showList :: [AnyVerificationKeySource] -> ShowS
Show)