module Cardano.CLI.EraIndependent.Cip.Cip129.Option
  ( pCip129
  )
where

import Cardano.CLI.EraIndependent.Cip.Command
import Cardano.CLI.EraIndependent.Cip.Common
import Cardano.CLI.Parser

import Data.Foldable
import Options.Applicative qualified as Opt

-- Add sub parsers
pCip129 :: Opt.Parser CipFormatCmds
pCip129 :: Parser CipFormatCmds
pCip129 =
  Cip129 -> CipFormatCmds
Cip129
    (Cip129 -> CipFormatCmds) -> Parser Cip129 -> Parser CipFormatCmds
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Parser Cip129] -> Parser Cip129
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum
      [ Mod CommandFields Cip129 -> Parser Cip129
forall a. Mod CommandFields a -> Parser a
Opt.hsubparser (Mod CommandFields Cip129 -> Parser Cip129)
-> Mod CommandFields Cip129 -> Parser Cip129
forall a b. (a -> b) -> a -> b
$
          String -> ParserInfo Cip129 -> Mod CommandFields Cip129
forall a. String -> ParserInfo a -> Mod CommandFields a
commandWithMetavar String
"drep" (ParserInfo Cip129 -> Mod CommandFields Cip129)
-> ParserInfo Cip129 -> Mod CommandFields Cip129
forall a b. (a -> b) -> a -> b
$
            Parser Cip129 -> InfoMod Cip129 -> ParserInfo Cip129
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser Cip129
pCip129Drep (InfoMod Cip129 -> ParserInfo Cip129)
-> InfoMod Cip129 -> ParserInfo Cip129
forall a b. (a -> b) -> a -> b
$
              String -> InfoMod Cip129
forall a. String -> InfoMod a
Opt.progDesc String
"Convert drep verification key to the cip-129 compliant format"
      , Mod CommandFields Cip129 -> Parser Cip129
forall a. Mod CommandFields a -> Parser a
Opt.hsubparser (Mod CommandFields Cip129 -> Parser Cip129)
-> Mod CommandFields Cip129 -> Parser Cip129
forall a b. (a -> b) -> a -> b
$
          String -> ParserInfo Cip129 -> Mod CommandFields Cip129
forall a. String -> ParserInfo a -> Mod CommandFields a
commandWithMetavar String
"committee-hot-key" (ParserInfo Cip129 -> Mod CommandFields Cip129)
-> ParserInfo Cip129 -> Mod CommandFields Cip129
forall a b. (a -> b) -> a -> b
$
            Parser Cip129 -> InfoMod Cip129 -> ParserInfo Cip129
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser Cip129
pCip129CommitteeHotKey (InfoMod Cip129 -> ParserInfo Cip129)
-> InfoMod Cip129 -> ParserInfo Cip129
forall a b. (a -> b) -> a -> b
$
              String -> InfoMod Cip129
forall a. String -> InfoMod a
Opt.progDesc String
"Convert committee hot key to the cip-129 compliant format"
      , Mod CommandFields Cip129 -> Parser Cip129
forall a. Mod CommandFields a -> Parser a
Opt.hsubparser (Mod CommandFields Cip129 -> Parser Cip129)
-> Mod CommandFields Cip129 -> Parser Cip129
forall a b. (a -> b) -> a -> b
$
          String -> ParserInfo Cip129 -> Mod CommandFields Cip129
forall a. String -> ParserInfo a -> Mod CommandFields a
commandWithMetavar String
"committee-cold-key" (ParserInfo Cip129 -> Mod CommandFields Cip129)
-> ParserInfo Cip129 -> Mod CommandFields Cip129
forall a b. (a -> b) -> a -> b
$
            Parser Cip129 -> InfoMod Cip129 -> ParserInfo Cip129
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser Cip129
pCip129CommitteeColdKey (InfoMod Cip129 -> ParserInfo Cip129)
-> InfoMod Cip129 -> ParserInfo Cip129
forall a b. (a -> b) -> a -> b
$
              String -> InfoMod Cip129
forall a. String -> InfoMod a
Opt.progDesc String
"Convert committee cold key to the cip-129 compliant format"
      , Mod CommandFields Cip129 -> Parser Cip129
forall a. Mod CommandFields a -> Parser a
Opt.hsubparser (Mod CommandFields Cip129 -> Parser Cip129)
-> Mod CommandFields Cip129 -> Parser Cip129
forall a b. (a -> b) -> a -> b
$
          String -> ParserInfo Cip129 -> Mod CommandFields Cip129
forall a. String -> ParserInfo a -> Mod CommandFields a
commandWithMetavar String
"governance-action-id" (ParserInfo Cip129 -> Mod CommandFields Cip129)
-> ParserInfo Cip129 -> Mod CommandFields Cip129
forall a b. (a -> b) -> a -> b
$
            Parser Cip129 -> InfoMod Cip129 -> ParserInfo Cip129
forall a. Parser a -> InfoMod a -> ParserInfo a
Opt.info Parser Cip129
pCip129GovernanceAction (InfoMod Cip129 -> ParserInfo Cip129)
-> InfoMod Cip129 -> ParserInfo Cip129
forall a b. (a -> b) -> a -> b
$
              String -> InfoMod Cip129
forall a. String -> InfoMod a
Opt.progDesc String
"Convert governance action id to the cip-129 compliant format"
      ]

pCip129Drep :: Opt.Parser Cip129
pCip129Drep :: Parser Cip129
pCip129Drep =
  Input -> Output -> Cip129
Cip129DRep
    (Input -> Output -> Cip129)
-> Parser Input -> Parser (Output -> Cip129)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser Input
pInput
    Parser (Output -> Cip129) -> Parser Output -> Parser Cip129
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser Output
pOutput
 where
  pInput :: Parser Input
pInput =
    [Parser Input] -> Parser Input
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum
      [ String -> String -> Parser Input
pInputFile String
"drep-file" String
"Input hex/bech32/text envelope drep file"
      , String -> String -> String -> Parser Input
pInputHexText String
"drep-hex" String
"HEX" String
"Input hex encoded drep"
      , String -> String -> String -> Parser Input
pInputBech32Text String
"drep-bech32" String
"BECH32" String
"Input bech32 encoded drep"
      ]

pCip129CommitteeHotKey :: Opt.Parser Cip129
pCip129CommitteeHotKey :: Parser Cip129
pCip129CommitteeHotKey =
  Input -> Output -> Cip129
Cip129CommitteeHotKey
    (Input -> Output -> Cip129)
-> Parser Input -> Parser (Output -> Cip129)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser Input
pInput
    Parser (Output -> Cip129) -> Parser Output -> Parser Cip129
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser Output
pOutput
 where
  pInput :: Parser Input
pInput =
    [Parser Input] -> Parser Input
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum
      [ String -> String -> Parser Input
pInputFile String
"committee-hot-key-file" String
"Input hex/bech32/text envelope committee hot key file"
      , String -> String -> String -> Parser Input
pInputHexText String
"committee-hot-key-hex" String
"HEX" String
"Input hex encoded committee hot key"
      , String -> String -> String -> Parser Input
pInputBech32Text String
"committee-hot-key-bech32" String
"BECH32" String
"Input bech32 encoded committee hot key"
      ]

pCip129CommitteeColdKey :: Opt.Parser Cip129
pCip129CommitteeColdKey :: Parser Cip129
pCip129CommitteeColdKey =
  Input -> Output -> Cip129
Cip129CommitteeColdKey
    (Input -> Output -> Cip129)
-> Parser Input -> Parser (Output -> Cip129)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser Input
pInput
    Parser (Output -> Cip129) -> Parser Output -> Parser Cip129
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser Output
pOutput
 where
  pInput :: Parser Input
pInput =
    [Parser Input] -> Parser Input
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum
      [ String -> String -> Parser Input
pInputFile String
"committee-cold-key-file" String
"Input hex/bech32/text envelope committee cold key file"
      , String -> String -> String -> Parser Input
pInputHexText String
"committee-cold-key-hex" String
"HEX" String
"Input hex encoded committee cold key"
      , String -> String -> String -> Parser Input
pInputBech32Text String
"committee-cold-key-bech32" String
"BECH32" String
"Input bech32 encoded committee cold key"
      ]

pCip129GovernanceAction :: Opt.Parser Cip129
pCip129GovernanceAction :: Parser Cip129
pCip129GovernanceAction =
  Input -> Output -> Cip129
Cip129GovernanceAction
    (Input -> Output -> Cip129)
-> Parser Input -> Parser (Output -> Cip129)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser Input
pInput
    Parser (Output -> Cip129) -> Parser Output -> Parser Cip129
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser Output
pOutput
 where
  pInput :: Parser Input
pInput =
    [Parser Input] -> Parser Input
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum
      [ String -> String -> Parser Input
pInputFile String
"governance-action-file" String
"Input hex/bech32/text envelope governance action file"
      , String -> String -> String -> Parser Input
pInputHexText String
"governance-action-hex" String
"HEX" String
"Input hex encoded governance action"
      , String -> String -> String -> Parser Input
pInputBech32Text String
"governance-action-bech32" String
"BECH32" String
"Input bech32 encoded governance action"
      ]

pOutput :: Opt.Parser Output
pOutput :: Parser Output
pOutput =
  [Parser Output] -> Parser Output
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum
    [ String -> String -> Parser Output
pOutputFile String
"output-file" String
"Output file"
    , String -> String -> Parser Output
pOutputText String
"output-text" String
"Output text"
    ]