{-# LANGUAGE DataKinds             #-}
{-# LANGUAGE DeriveAnyClass        #-}
{-# LANGUAGE DeriveGeneric         #-}
{-# LANGUAGE DerivingStrategies    #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-|
  Module      : Auth.Biscuit.Proto
  Copyright   : © Clément Delafargue, 2021
  License     : BSD-3-Clause
  Maintainer  : clement@delafargue.name
  Haskell data structures mapping the biscuit protobuf definitions
-}

module Auth.Biscuit.Proto
  ( Biscuit (..)
  , SignedBlock (..)
  , PublicKey (..)
  , Algorithm (..)
  , ExternalSig (..)
  , Proof (..)
  , Block (..)
  , Scope (..)
  , ScopeType (..)
  , Fact (..)
  , Rule (..)
  , CheckKind (..)
  , Check (..)
  , Predicate (..)
  , Term (..)
  , Expression (..)
  , TermSet (..)
  , TermArray (..)
  , TermMap (..)
  , MapKey (..)
  , MapEntry (..)
  , Empty (..)
  , Op (..)
  , OpUnary (..)
  , UnaryKind (..)
  , OpBinary (..)
  , BinaryKind (..)
  , OpClosure (..)
  , ThirdPartyBlockContents (..)
  , ThirdPartyBlockRequest (..)
  , getField
  , putField
  , decodeBlockList
  , decodeBlock
  , encodeBlockList
  , encodeBlock
  , decodeThirdPartyBlockRequest
  , decodeThirdPartyBlockContents
  , encodeThirdPartyBlockRequest
  , encodeThirdPartyBlockContents
  ) where

import           Data.ByteString      (ByteString)
import           Data.Int
import           Data.ProtocolBuffers
import           Data.Serialize
import           Data.Text
import           GHC.Generics         (Generic)

data Biscuit = Biscuit
  { Biscuit -> Optional 1 (Value Int32)
rootKeyId :: Optional 1 (Value Int32)
  , Biscuit -> Required 2 (Message SignedBlock)
authority :: Required 2 (Message SignedBlock)
  , Biscuit -> Repeated 3 (Message SignedBlock)
blocks    :: Repeated 3 (Message SignedBlock)
  , Biscuit -> Required 4 (Message Proof)
proof     :: Required 4 (Message Proof)
  } deriving ((forall x. Biscuit -> Rep Biscuit x)
-> (forall x. Rep Biscuit x -> Biscuit) -> Generic Biscuit
forall x. Rep Biscuit x -> Biscuit
forall x. Biscuit -> Rep Biscuit x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Biscuit -> Rep Biscuit x
from :: forall x. Biscuit -> Rep Biscuit x
$cto :: forall x. Rep Biscuit x -> Biscuit
to :: forall x. Rep Biscuit x -> Biscuit
Generic, Int -> Biscuit -> ShowS
[Biscuit] -> ShowS
Biscuit -> String
(Int -> Biscuit -> ShowS)
-> (Biscuit -> String) -> ([Biscuit] -> ShowS) -> Show Biscuit
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Biscuit -> ShowS
showsPrec :: Int -> Biscuit -> ShowS
$cshow :: Biscuit -> String
show :: Biscuit -> String
$cshowList :: [Biscuit] -> ShowS
showList :: [Biscuit] -> ShowS
Show)
    deriving anyclass (HashMap Tag [WireField] -> Get Biscuit
(HashMap Tag [WireField] -> Get Biscuit) -> Decode Biscuit
forall a. (HashMap Tag [WireField] -> Get a) -> Decode a
$cdecode :: HashMap Tag [WireField] -> Get Biscuit
decode :: HashMap Tag [WireField] -> Get Biscuit
Decode, Biscuit -> Put
(Biscuit -> Put) -> Encode Biscuit
forall a. (a -> Put) -> Encode a
$cencode :: Biscuit -> Put
encode :: Biscuit -> Put
Encode)

data Proof =
    ProofSecret    (Required 1 (Value ByteString))
  | ProofSignature (Required 2 (Value ByteString))
  deriving ((forall x. Proof -> Rep Proof x)
-> (forall x. Rep Proof x -> Proof) -> Generic Proof
forall x. Rep Proof x -> Proof
forall x. Proof -> Rep Proof x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Proof -> Rep Proof x
from :: forall x. Proof -> Rep Proof x
$cto :: forall x. Rep Proof x -> Proof
to :: forall x. Rep Proof x -> Proof
Generic, Int -> Proof -> ShowS
[Proof] -> ShowS
Proof -> String
(Int -> Proof -> ShowS)
-> (Proof -> String) -> ([Proof] -> ShowS) -> Show Proof
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Proof -> ShowS
showsPrec :: Int -> Proof -> ShowS
$cshow :: Proof -> String
show :: Proof -> String
$cshowList :: [Proof] -> ShowS
showList :: [Proof] -> ShowS
Show)
  deriving anyclass (HashMap Tag [WireField] -> Get Proof
(HashMap Tag [WireField] -> Get Proof) -> Decode Proof
forall a. (HashMap Tag [WireField] -> Get a) -> Decode a
$cdecode :: HashMap Tag [WireField] -> Get Proof
decode :: HashMap Tag [WireField] -> Get Proof
Decode, Proof -> Put
(Proof -> Put) -> Encode Proof
forall a. (a -> Put) -> Encode a
$cencode :: Proof -> Put
encode :: Proof -> Put
Encode)

data ExternalSig = ExternalSig
  { ExternalSig -> Required 1 (Value ByteString)
signature :: Required 1 (Value ByteString)
  , ExternalSig -> Required 2 (Message PublicKey)
publicKey :: Required 2 (Message PublicKey)
  }
  deriving ((forall x. ExternalSig -> Rep ExternalSig x)
-> (forall x. Rep ExternalSig x -> ExternalSig)
-> Generic ExternalSig
forall x. Rep ExternalSig x -> ExternalSig
forall x. ExternalSig -> Rep ExternalSig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ExternalSig -> Rep ExternalSig x
from :: forall x. ExternalSig -> Rep ExternalSig x
$cto :: forall x. Rep ExternalSig x -> ExternalSig
to :: forall x. Rep ExternalSig x -> ExternalSig
Generic, Int -> ExternalSig -> ShowS
[ExternalSig] -> ShowS
ExternalSig -> String
(Int -> ExternalSig -> ShowS)
-> (ExternalSig -> String)
-> ([ExternalSig] -> ShowS)
-> Show ExternalSig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ExternalSig -> ShowS
showsPrec :: Int -> ExternalSig -> ShowS
$cshow :: ExternalSig -> String
show :: ExternalSig -> String
$cshowList :: [ExternalSig] -> ShowS
showList :: [ExternalSig] -> ShowS
Show)
  deriving anyclass (HashMap Tag [WireField] -> Get ExternalSig
(HashMap Tag [WireField] -> Get ExternalSig) -> Decode ExternalSig
forall a. (HashMap Tag [WireField] -> Get a) -> Decode a
$cdecode :: HashMap Tag [WireField] -> Get ExternalSig
decode :: HashMap Tag [WireField] -> Get ExternalSig
Decode, ExternalSig -> Put
(ExternalSig -> Put) -> Encode ExternalSig
forall a. (a -> Put) -> Encode a
$cencode :: ExternalSig -> Put
encode :: ExternalSig -> Put
Encode)

data SignedBlock = SignedBlock
  { SignedBlock -> Required 1 (Value ByteString)
block       :: Required 1 (Value ByteString)
  , SignedBlock -> Required 2 (Message PublicKey)
nextKey     :: Required 2 (Message PublicKey)
  , SignedBlock -> Required 3 (Value ByteString)
signature   :: Required 3 (Value ByteString)
  , SignedBlock -> Optional 4 (Message ExternalSig)
externalSig :: Optional 4 (Message ExternalSig)
  , SignedBlock -> Optional 5 (Value Int32)
version     :: Optional 5 (Value Int32)
  }
  deriving ((forall x. SignedBlock -> Rep SignedBlock x)
-> (forall x. Rep SignedBlock x -> SignedBlock)
-> Generic SignedBlock
forall x. Rep SignedBlock x -> SignedBlock
forall x. SignedBlock -> Rep SignedBlock x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. SignedBlock -> Rep SignedBlock x
from :: forall x. SignedBlock -> Rep SignedBlock x
$cto :: forall x. Rep SignedBlock x -> SignedBlock
to :: forall x. Rep SignedBlock x -> SignedBlock
Generic, Int -> SignedBlock -> ShowS
[SignedBlock] -> ShowS
SignedBlock -> String
(Int -> SignedBlock -> ShowS)
-> (SignedBlock -> String)
-> ([SignedBlock] -> ShowS)
-> Show SignedBlock
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SignedBlock -> ShowS
showsPrec :: Int -> SignedBlock -> ShowS
$cshow :: SignedBlock -> String
show :: SignedBlock -> String
$cshowList :: [SignedBlock] -> ShowS
showList :: [SignedBlock] -> ShowS
Show)
  deriving anyclass (HashMap Tag [WireField] -> Get SignedBlock
(HashMap Tag [WireField] -> Get SignedBlock) -> Decode SignedBlock
forall a. (HashMap Tag [WireField] -> Get a) -> Decode a
$cdecode :: HashMap Tag [WireField] -> Get SignedBlock
decode :: HashMap Tag [WireField] -> Get SignedBlock
Decode, SignedBlock -> Put
(SignedBlock -> Put) -> Encode SignedBlock
forall a. (a -> Put) -> Encode a
$cencode :: SignedBlock -> Put
encode :: SignedBlock -> Put
Encode)

data Algorithm = Ed25519
  deriving stock (Int -> Algorithm -> ShowS
[Algorithm] -> ShowS
Algorithm -> String
(Int -> Algorithm -> ShowS)
-> (Algorithm -> String)
-> ([Algorithm] -> ShowS)
-> Show Algorithm
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Algorithm -> ShowS
showsPrec :: Int -> Algorithm -> ShowS
$cshow :: Algorithm -> String
show :: Algorithm -> String
$cshowList :: [Algorithm] -> ShowS
showList :: [Algorithm] -> ShowS
Show, Int -> Algorithm
Algorithm -> Int
Algorithm -> [Algorithm]
Algorithm -> Algorithm
Algorithm -> Algorithm -> [Algorithm]
Algorithm -> Algorithm -> Algorithm -> [Algorithm]
(Algorithm -> Algorithm)
-> (Algorithm -> Algorithm)
-> (Int -> Algorithm)
-> (Algorithm -> Int)
-> (Algorithm -> [Algorithm])
-> (Algorithm -> Algorithm -> [Algorithm])
-> (Algorithm -> Algorithm -> [Algorithm])
-> (Algorithm -> Algorithm -> Algorithm -> [Algorithm])
-> Enum Algorithm
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: Algorithm -> Algorithm
succ :: Algorithm -> Algorithm
$cpred :: Algorithm -> Algorithm
pred :: Algorithm -> Algorithm
$ctoEnum :: Int -> Algorithm
toEnum :: Int -> Algorithm
$cfromEnum :: Algorithm -> Int
fromEnum :: Algorithm -> Int
$cenumFrom :: Algorithm -> [Algorithm]
enumFrom :: Algorithm -> [Algorithm]
$cenumFromThen :: Algorithm -> Algorithm -> [Algorithm]
enumFromThen :: Algorithm -> Algorithm -> [Algorithm]
$cenumFromTo :: Algorithm -> Algorithm -> [Algorithm]
enumFromTo :: Algorithm -> Algorithm -> [Algorithm]
$cenumFromThenTo :: Algorithm -> Algorithm -> Algorithm -> [Algorithm]
enumFromThenTo :: Algorithm -> Algorithm -> Algorithm -> [Algorithm]
Enum, Algorithm
Algorithm -> Algorithm -> Bounded Algorithm
forall a. a -> a -> Bounded a
$cminBound :: Algorithm
minBound :: Algorithm
$cmaxBound :: Algorithm
maxBound :: Algorithm
Bounded)

data PublicKey = PublicKey
  { PublicKey -> Required 1 (Enumeration Algorithm)
algorithm :: Required 1 (Enumeration Algorithm)
  , PublicKey -> Required 2 (Value ByteString)
key       :: Required 2 (Value ByteString)
  }
  deriving ((forall x. PublicKey -> Rep PublicKey x)
-> (forall x. Rep PublicKey x -> PublicKey) -> Generic PublicKey
forall x. Rep PublicKey x -> PublicKey
forall x. PublicKey -> Rep PublicKey x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. PublicKey -> Rep PublicKey x
from :: forall x. PublicKey -> Rep PublicKey x
$cto :: forall x. Rep PublicKey x -> PublicKey
to :: forall x. Rep PublicKey x -> PublicKey
Generic, Int -> PublicKey -> ShowS
[PublicKey] -> ShowS
PublicKey -> String
(Int -> PublicKey -> ShowS)
-> (PublicKey -> String)
-> ([PublicKey] -> ShowS)
-> Show PublicKey
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PublicKey -> ShowS
showsPrec :: Int -> PublicKey -> ShowS
$cshow :: PublicKey -> String
show :: PublicKey -> String
$cshowList :: [PublicKey] -> ShowS
showList :: [PublicKey] -> ShowS
Show)
  deriving anyclass (HashMap Tag [WireField] -> Get PublicKey
(HashMap Tag [WireField] -> Get PublicKey) -> Decode PublicKey
forall a. (HashMap Tag [WireField] -> Get a) -> Decode a
$cdecode :: HashMap Tag [WireField] -> Get PublicKey
decode :: HashMap Tag [WireField] -> Get PublicKey
Decode, PublicKey -> Put
(PublicKey -> Put) -> Encode PublicKey
forall a. (a -> Put) -> Encode a
$cencode :: PublicKey -> Put
encode :: PublicKey -> Put
Encode)

data Block = Block {
    Block -> Repeated 1 (Value Text)
symbols  :: Repeated 1 (Value Text)
  , Block -> Optional 2 (Value Text)
context  :: Optional 2 (Value Text)
  , Block -> Optional 3 (Value Int32)
version  :: Optional 3 (Value Int32)
  , Block -> Repeated 4 (Message Fact)
facts    :: Repeated 4 (Message Fact)
  , Block -> Repeated 5 (Message Rule)
rules    :: Repeated 5 (Message Rule)
  , Block -> Repeated 6 (Message Check)
checks   :: Repeated 6 (Message Check)
  , Block -> Repeated 7 (Message Scope)
scope    :: Repeated 7 (Message Scope)
  , Block -> Repeated 8 (Message PublicKey)
pksTable :: Repeated 8 (Message PublicKey)
  } deriving stock ((forall x. Block -> Rep Block x)
-> (forall x. Rep Block x -> Block) -> Generic Block
forall x. Rep Block x -> Block
forall x. Block -> Rep Block x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Block -> Rep Block x
from :: forall x. Block -> Rep Block x
$cto :: forall x. Rep Block x -> Block
to :: forall x. Rep Block x -> Block
Generic, Int -> Block -> ShowS
[Block] -> ShowS
Block -> String
(Int -> Block -> ShowS)
-> (Block -> String) -> ([Block] -> ShowS) -> Show Block
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Block -> ShowS
showsPrec :: Int -> Block -> ShowS
$cshow :: Block -> String
show :: Block -> String
$cshowList :: [Block] -> ShowS
showList :: [Block] -> ShowS
Show)
    deriving anyclass (HashMap Tag [WireField] -> Get Block
(HashMap Tag [WireField] -> Get Block) -> Decode Block
forall a. (HashMap Tag [WireField] -> Get a) -> Decode a
$cdecode :: HashMap Tag [WireField] -> Get Block
decode :: HashMap Tag [WireField] -> Get Block
Decode, Block -> Put
(Block -> Put) -> Encode Block
forall a. (a -> Put) -> Encode a
$cencode :: Block -> Put
encode :: Block -> Put
Encode)

data ScopeType =
    ScopeAuthority
  | ScopePrevious
  deriving stock (Int -> ScopeType -> ShowS
[ScopeType] -> ShowS
ScopeType -> String
(Int -> ScopeType -> ShowS)
-> (ScopeType -> String)
-> ([ScopeType] -> ShowS)
-> Show ScopeType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ScopeType -> ShowS
showsPrec :: Int -> ScopeType -> ShowS
$cshow :: ScopeType -> String
show :: ScopeType -> String
$cshowList :: [ScopeType] -> ShowS
showList :: [ScopeType] -> ShowS
Show, Int -> ScopeType
ScopeType -> Int
ScopeType -> [ScopeType]
ScopeType -> ScopeType
ScopeType -> ScopeType -> [ScopeType]
ScopeType -> ScopeType -> ScopeType -> [ScopeType]
(ScopeType -> ScopeType)
-> (ScopeType -> ScopeType)
-> (Int -> ScopeType)
-> (ScopeType -> Int)
-> (ScopeType -> [ScopeType])
-> (ScopeType -> ScopeType -> [ScopeType])
-> (ScopeType -> ScopeType -> [ScopeType])
-> (ScopeType -> ScopeType -> ScopeType -> [ScopeType])
-> Enum ScopeType
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: ScopeType -> ScopeType
succ :: ScopeType -> ScopeType
$cpred :: ScopeType -> ScopeType
pred :: ScopeType -> ScopeType
$ctoEnum :: Int -> ScopeType
toEnum :: Int -> ScopeType
$cfromEnum :: ScopeType -> Int
fromEnum :: ScopeType -> Int
$cenumFrom :: ScopeType -> [ScopeType]
enumFrom :: ScopeType -> [ScopeType]
$cenumFromThen :: ScopeType -> ScopeType -> [ScopeType]
enumFromThen :: ScopeType -> ScopeType -> [ScopeType]
$cenumFromTo :: ScopeType -> ScopeType -> [ScopeType]
enumFromTo :: ScopeType -> ScopeType -> [ScopeType]
$cenumFromThenTo :: ScopeType -> ScopeType -> ScopeType -> [ScopeType]
enumFromThenTo :: ScopeType -> ScopeType -> ScopeType -> [ScopeType]
Enum, ScopeType
ScopeType -> ScopeType -> Bounded ScopeType
forall a. a -> a -> Bounded a
$cminBound :: ScopeType
minBound :: ScopeType
$cmaxBound :: ScopeType
maxBound :: ScopeType
Bounded)

data Scope =
    ScType  (Required 1 (Enumeration ScopeType))
  | ScBlock (Required 2 (Value Int64))
    deriving stock ((forall x. Scope -> Rep Scope x)
-> (forall x. Rep Scope x -> Scope) -> Generic Scope
forall x. Rep Scope x -> Scope
forall x. Scope -> Rep Scope x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Scope -> Rep Scope x
from :: forall x. Scope -> Rep Scope x
$cto :: forall x. Rep Scope x -> Scope
to :: forall x. Rep Scope x -> Scope
Generic, Int -> Scope -> ShowS
[Scope] -> ShowS
Scope -> String
(Int -> Scope -> ShowS)
-> (Scope -> String) -> ([Scope] -> ShowS) -> Show Scope
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Scope -> ShowS
showsPrec :: Int -> Scope -> ShowS
$cshow :: Scope -> String
show :: Scope -> String
$cshowList :: [Scope] -> ShowS
showList :: [Scope] -> ShowS
Show)
    deriving anyclass (HashMap Tag [WireField] -> Get Scope
(HashMap Tag [WireField] -> Get Scope) -> Decode Scope
forall a. (HashMap Tag [WireField] -> Get a) -> Decode a
$cdecode :: HashMap Tag [WireField] -> Get Scope
decode :: HashMap Tag [WireField] -> Get Scope
Decode, Scope -> Put
(Scope -> Put) -> Encode Scope
forall a. (a -> Put) -> Encode a
$cencode :: Scope -> Put
encode :: Scope -> Put
Encode)

newtype Fact = Fact
  { Fact -> Required 1 (Message Predicate)
predicate :: Required 1 (Message Predicate)
  } deriving stock ((forall x. Fact -> Rep Fact x)
-> (forall x. Rep Fact x -> Fact) -> Generic Fact
forall x. Rep Fact x -> Fact
forall x. Fact -> Rep Fact x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Fact -> Rep Fact x
from :: forall x. Fact -> Rep Fact x
$cto :: forall x. Rep Fact x -> Fact
to :: forall x. Rep Fact x -> Fact
Generic, Int -> Fact -> ShowS
[Fact] -> ShowS
Fact -> String
(Int -> Fact -> ShowS)
-> (Fact -> String) -> ([Fact] -> ShowS) -> Show Fact
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Fact -> ShowS
showsPrec :: Int -> Fact -> ShowS
$cshow :: Fact -> String
show :: Fact -> String
$cshowList :: [Fact] -> ShowS
showList :: [Fact] -> ShowS
Show)
    deriving anyclass (HashMap Tag [WireField] -> Get Fact
(HashMap Tag [WireField] -> Get Fact) -> Decode Fact
forall a. (HashMap Tag [WireField] -> Get a) -> Decode a
$cdecode :: HashMap Tag [WireField] -> Get Fact
decode :: HashMap Tag [WireField] -> Get Fact
Decode, Fact -> Put
(Fact -> Put) -> Encode Fact
forall a. (a -> Put) -> Encode a
$cencode :: Fact -> Put
encode :: Fact -> Put
Encode)

data Rule = Rule
  { Rule -> Required 1 (Message Predicate)
head        :: Required 1 (Message Predicate)
  , Rule -> Repeated 2 (Message Predicate)
body        :: Repeated 2 (Message Predicate)
  , Rule -> Repeated 3 (Message Expression)
expressions :: Repeated 3 (Message Expression)
  , Rule -> Repeated 4 (Message Scope)
scope       :: Repeated 4 (Message Scope)
  } deriving stock ((forall x. Rule -> Rep Rule x)
-> (forall x. Rep Rule x -> Rule) -> Generic Rule
forall x. Rep Rule x -> Rule
forall x. Rule -> Rep Rule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Rule -> Rep Rule x
from :: forall x. Rule -> Rep Rule x
$cto :: forall x. Rep Rule x -> Rule
to :: forall x. Rep Rule x -> Rule
Generic, Int -> Rule -> ShowS
[Rule] -> ShowS
Rule -> String
(Int -> Rule -> ShowS)
-> (Rule -> String) -> ([Rule] -> ShowS) -> Show Rule
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Rule -> ShowS
showsPrec :: Int -> Rule -> ShowS
$cshow :: Rule -> String
show :: Rule -> String
$cshowList :: [Rule] -> ShowS
showList :: [Rule] -> ShowS
Show)
    deriving anyclass (HashMap Tag [WireField] -> Get Rule
(HashMap Tag [WireField] -> Get Rule) -> Decode Rule
forall a. (HashMap Tag [WireField] -> Get a) -> Decode a
$cdecode :: HashMap Tag [WireField] -> Get Rule
decode :: HashMap Tag [WireField] -> Get Rule
Decode, Rule -> Put
(Rule -> Put) -> Encode Rule
forall a. (a -> Put) -> Encode a
$cencode :: Rule -> Put
encode :: Rule -> Put
Encode)

data CheckKind =
    CheckOne
  | CheckAll
  | Reject
  deriving stock (Int -> CheckKind -> ShowS
[CheckKind] -> ShowS
CheckKind -> String
(Int -> CheckKind -> ShowS)
-> (CheckKind -> String)
-> ([CheckKind] -> ShowS)
-> Show CheckKind
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CheckKind -> ShowS
showsPrec :: Int -> CheckKind -> ShowS
$cshow :: CheckKind -> String
show :: CheckKind -> String
$cshowList :: [CheckKind] -> ShowS
showList :: [CheckKind] -> ShowS
Show, Int -> CheckKind
CheckKind -> Int
CheckKind -> [CheckKind]
CheckKind -> CheckKind
CheckKind -> CheckKind -> [CheckKind]
CheckKind -> CheckKind -> CheckKind -> [CheckKind]
(CheckKind -> CheckKind)
-> (CheckKind -> CheckKind)
-> (Int -> CheckKind)
-> (CheckKind -> Int)
-> (CheckKind -> [CheckKind])
-> (CheckKind -> CheckKind -> [CheckKind])
-> (CheckKind -> CheckKind -> [CheckKind])
-> (CheckKind -> CheckKind -> CheckKind -> [CheckKind])
-> Enum CheckKind
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: CheckKind -> CheckKind
succ :: CheckKind -> CheckKind
$cpred :: CheckKind -> CheckKind
pred :: CheckKind -> CheckKind
$ctoEnum :: Int -> CheckKind
toEnum :: Int -> CheckKind
$cfromEnum :: CheckKind -> Int
fromEnum :: CheckKind -> Int
$cenumFrom :: CheckKind -> [CheckKind]
enumFrom :: CheckKind -> [CheckKind]
$cenumFromThen :: CheckKind -> CheckKind -> [CheckKind]
enumFromThen :: CheckKind -> CheckKind -> [CheckKind]
$cenumFromTo :: CheckKind -> CheckKind -> [CheckKind]
enumFromTo :: CheckKind -> CheckKind -> [CheckKind]
$cenumFromThenTo :: CheckKind -> CheckKind -> CheckKind -> [CheckKind]
enumFromThenTo :: CheckKind -> CheckKind -> CheckKind -> [CheckKind]
Enum, CheckKind
CheckKind -> CheckKind -> Bounded CheckKind
forall a. a -> a -> Bounded a
$cminBound :: CheckKind
minBound :: CheckKind
$cmaxBound :: CheckKind
maxBound :: CheckKind
Bounded)

data Check = Check
  { Check -> Repeated 1 (Message Rule)
queries :: Repeated 1 (Message Rule)
  , Check -> Optional 2 (Enumeration CheckKind)
kind    :: Optional 2 (Enumeration CheckKind)
  } deriving stock ((forall x. Check -> Rep Check x)
-> (forall x. Rep Check x -> Check) -> Generic Check
forall x. Rep Check x -> Check
forall x. Check -> Rep Check x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Check -> Rep Check x
from :: forall x. Check -> Rep Check x
$cto :: forall x. Rep Check x -> Check
to :: forall x. Rep Check x -> Check
Generic, Int -> Check -> ShowS
[Check] -> ShowS
Check -> String
(Int -> Check -> ShowS)
-> (Check -> String) -> ([Check] -> ShowS) -> Show Check
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Check -> ShowS
showsPrec :: Int -> Check -> ShowS
$cshow :: Check -> String
show :: Check -> String
$cshowList :: [Check] -> ShowS
showList :: [Check] -> ShowS
Show)
    deriving anyclass (HashMap Tag [WireField] -> Get Check
(HashMap Tag [WireField] -> Get Check) -> Decode Check
forall a. (HashMap Tag [WireField] -> Get a) -> Decode a
$cdecode :: HashMap Tag [WireField] -> Get Check
decode :: HashMap Tag [WireField] -> Get Check
Decode, Check -> Put
(Check -> Put) -> Encode Check
forall a. (a -> Put) -> Encode a
$cencode :: Check -> Put
encode :: Check -> Put
Encode)

data Predicate = Predicate
  { Predicate -> Required 1 (Value Int64)
name  :: Required 1 (Value Int64)
  , Predicate -> Repeated 2 (Message Term)
terms :: Repeated 2 (Message Term)
  } deriving stock ((forall x. Predicate -> Rep Predicate x)
-> (forall x. Rep Predicate x -> Predicate) -> Generic Predicate
forall x. Rep Predicate x -> Predicate
forall x. Predicate -> Rep Predicate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Predicate -> Rep Predicate x
from :: forall x. Predicate -> Rep Predicate x
$cto :: forall x. Rep Predicate x -> Predicate
to :: forall x. Rep Predicate x -> Predicate
Generic, Int -> Predicate -> ShowS
[Predicate] -> ShowS
Predicate -> String
(Int -> Predicate -> ShowS)
-> (Predicate -> String)
-> ([Predicate] -> ShowS)
-> Show Predicate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Predicate -> ShowS
showsPrec :: Int -> Predicate -> ShowS
$cshow :: Predicate -> String
show :: Predicate -> String
$cshowList :: [Predicate] -> ShowS
showList :: [Predicate] -> ShowS
Show)
    deriving anyclass (HashMap Tag [WireField] -> Get Predicate
(HashMap Tag [WireField] -> Get Predicate) -> Decode Predicate
forall a. (HashMap Tag [WireField] -> Get a) -> Decode a
$cdecode :: HashMap Tag [WireField] -> Get Predicate
decode :: HashMap Tag [WireField] -> Get Predicate
Decode, Predicate -> Put
(Predicate -> Put) -> Encode Predicate
forall a. (a -> Put) -> Encode a
$cencode :: Predicate -> Put
encode :: Predicate -> Put
Encode)

data Term =
    TermVariable  (Required 1  (Value Int64))
  | TermInteger   (Required 2  (Value Int64))
  | TermString    (Required 3  (Value Int64))
  | TermDate      (Required 4  (Value Int64))
  | TermBytes     (Required 5  (Value ByteString))
  | TermBool      (Required 6  (Value Bool))
  | TermTermSet   (Required 7  (Message TermSet))
  | TermNull      (Required 8  (Message Empty))
  | TermTermArray (Required 9  (Message TermArray))
  | TermTermMap   (Required 10 (Message TermMap))
    deriving stock ((forall x. Term -> Rep Term x)
-> (forall x. Rep Term x -> Term) -> Generic Term
forall x. Rep Term x -> Term
forall x. Term -> Rep Term x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Term -> Rep Term x
from :: forall x. Term -> Rep Term x
$cto :: forall x. Rep Term x -> Term
to :: forall x. Rep Term x -> Term
Generic, Int -> Term -> ShowS
[Term] -> ShowS
Term -> String
(Int -> Term -> ShowS)
-> (Term -> String) -> ([Term] -> ShowS) -> Show Term
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Term -> ShowS
showsPrec :: Int -> Term -> ShowS
$cshow :: Term -> String
show :: Term -> String
$cshowList :: [Term] -> ShowS
showList :: [Term] -> ShowS
Show)
    deriving anyclass (HashMap Tag [WireField] -> Get Term
(HashMap Tag [WireField] -> Get Term) -> Decode Term
forall a. (HashMap Tag [WireField] -> Get a) -> Decode a
$cdecode :: HashMap Tag [WireField] -> Get Term
decode :: HashMap Tag [WireField] -> Get Term
Decode, Term -> Put
(Term -> Put) -> Encode Term
forall a. (a -> Put) -> Encode a
$cencode :: Term -> Put
encode :: Term -> Put
Encode)

data Empty = Empty {}
    deriving stock ((forall x. Empty -> Rep Empty x)
-> (forall x. Rep Empty x -> Empty) -> Generic Empty
forall x. Rep Empty x -> Empty
forall x. Empty -> Rep Empty x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Empty -> Rep Empty x
from :: forall x. Empty -> Rep Empty x
$cto :: forall x. Rep Empty x -> Empty
to :: forall x. Rep Empty x -> Empty
Generic, Int -> Empty -> ShowS
[Empty] -> ShowS
Empty -> String
(Int -> Empty -> ShowS)
-> (Empty -> String) -> ([Empty] -> ShowS) -> Show Empty
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Empty -> ShowS
showsPrec :: Int -> Empty -> ShowS
$cshow :: Empty -> String
show :: Empty -> String
$cshowList :: [Empty] -> ShowS
showList :: [Empty] -> ShowS
Show)
    deriving anyclass (HashMap Tag [WireField] -> Get Empty
(HashMap Tag [WireField] -> Get Empty) -> Decode Empty
forall a. (HashMap Tag [WireField] -> Get a) -> Decode a
$cdecode :: HashMap Tag [WireField] -> Get Empty
decode :: HashMap Tag [WireField] -> Get Empty
Decode, Empty -> Put
(Empty -> Put) -> Encode Empty
forall a. (a -> Put) -> Encode a
$cencode :: Empty -> Put
encode :: Empty -> Put
Encode)


newtype TermSet = TermSet
  { TermSet -> Repeated 1 (Message Term)
set :: Repeated 1 (Message Term)
  } deriving stock ((forall x. TermSet -> Rep TermSet x)
-> (forall x. Rep TermSet x -> TermSet) -> Generic TermSet
forall x. Rep TermSet x -> TermSet
forall x. TermSet -> Rep TermSet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. TermSet -> Rep TermSet x
from :: forall x. TermSet -> Rep TermSet x
$cto :: forall x. Rep TermSet x -> TermSet
to :: forall x. Rep TermSet x -> TermSet
Generic, Int -> TermSet -> ShowS
[TermSet] -> ShowS
TermSet -> String
(Int -> TermSet -> ShowS)
-> (TermSet -> String) -> ([TermSet] -> ShowS) -> Show TermSet
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TermSet -> ShowS
showsPrec :: Int -> TermSet -> ShowS
$cshow :: TermSet -> String
show :: TermSet -> String
$cshowList :: [TermSet] -> ShowS
showList :: [TermSet] -> ShowS
Show)
    deriving anyclass (HashMap Tag [WireField] -> Get TermSet
(HashMap Tag [WireField] -> Get TermSet) -> Decode TermSet
forall a. (HashMap Tag [WireField] -> Get a) -> Decode a
$cdecode :: HashMap Tag [WireField] -> Get TermSet
decode :: HashMap Tag [WireField] -> Get TermSet
Decode, TermSet -> Put
(TermSet -> Put) -> Encode TermSet
forall a. (a -> Put) -> Encode a
$cencode :: TermSet -> Put
encode :: TermSet -> Put
Encode)

newtype TermArray = TermArray
  { TermArray -> Repeated 1 (Message Term)
array :: Repeated 1 (Message Term)
  } deriving stock ((forall x. TermArray -> Rep TermArray x)
-> (forall x. Rep TermArray x -> TermArray) -> Generic TermArray
forall x. Rep TermArray x -> TermArray
forall x. TermArray -> Rep TermArray x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. TermArray -> Rep TermArray x
from :: forall x. TermArray -> Rep TermArray x
$cto :: forall x. Rep TermArray x -> TermArray
to :: forall x. Rep TermArray x -> TermArray
Generic, Int -> TermArray -> ShowS
[TermArray] -> ShowS
TermArray -> String
(Int -> TermArray -> ShowS)
-> (TermArray -> String)
-> ([TermArray] -> ShowS)
-> Show TermArray
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TermArray -> ShowS
showsPrec :: Int -> TermArray -> ShowS
$cshow :: TermArray -> String
show :: TermArray -> String
$cshowList :: [TermArray] -> ShowS
showList :: [TermArray] -> ShowS
Show)
    deriving anyclass (HashMap Tag [WireField] -> Get TermArray
(HashMap Tag [WireField] -> Get TermArray) -> Decode TermArray
forall a. (HashMap Tag [WireField] -> Get a) -> Decode a
$cdecode :: HashMap Tag [WireField] -> Get TermArray
decode :: HashMap Tag [WireField] -> Get TermArray
Decode, TermArray -> Put
(TermArray -> Put) -> Encode TermArray
forall a. (a -> Put) -> Encode a
$cencode :: TermArray -> Put
encode :: TermArray -> Put
Encode)

data MapKey =
    MapKeyInt    (Required 1 (Value Int64))
  | MapKeyString (Required 2 (Value Int64))
    deriving stock ((forall x. MapKey -> Rep MapKey x)
-> (forall x. Rep MapKey x -> MapKey) -> Generic MapKey
forall x. Rep MapKey x -> MapKey
forall x. MapKey -> Rep MapKey x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. MapKey -> Rep MapKey x
from :: forall x. MapKey -> Rep MapKey x
$cto :: forall x. Rep MapKey x -> MapKey
to :: forall x. Rep MapKey x -> MapKey
Generic, Int -> MapKey -> ShowS
[MapKey] -> ShowS
MapKey -> String
(Int -> MapKey -> ShowS)
-> (MapKey -> String) -> ([MapKey] -> ShowS) -> Show MapKey
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> MapKey -> ShowS
showsPrec :: Int -> MapKey -> ShowS
$cshow :: MapKey -> String
show :: MapKey -> String
$cshowList :: [MapKey] -> ShowS
showList :: [MapKey] -> ShowS
Show)
    deriving anyclass (HashMap Tag [WireField] -> Get MapKey
(HashMap Tag [WireField] -> Get MapKey) -> Decode MapKey
forall a. (HashMap Tag [WireField] -> Get a) -> Decode a
$cdecode :: HashMap Tag [WireField] -> Get MapKey
decode :: HashMap Tag [WireField] -> Get MapKey
Decode, MapKey -> Put
(MapKey -> Put) -> Encode MapKey
forall a. (a -> Put) -> Encode a
$cencode :: MapKey -> Put
encode :: MapKey -> Put
Encode)

data MapEntry = MapEntry
  { MapEntry -> Required 1 (Message MapKey)
key   ::   Required 1 (Message MapKey)
  , MapEntry -> Required 2 (Message Term)
value :: Required 2 (Message Term)
  } deriving stock ((forall x. MapEntry -> Rep MapEntry x)
-> (forall x. Rep MapEntry x -> MapEntry) -> Generic MapEntry
forall x. Rep MapEntry x -> MapEntry
forall x. MapEntry -> Rep MapEntry x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. MapEntry -> Rep MapEntry x
from :: forall x. MapEntry -> Rep MapEntry x
$cto :: forall x. Rep MapEntry x -> MapEntry
to :: forall x. Rep MapEntry x -> MapEntry
Generic, Int -> MapEntry -> ShowS
[MapEntry] -> ShowS
MapEntry -> String
(Int -> MapEntry -> ShowS)
-> (MapEntry -> String) -> ([MapEntry] -> ShowS) -> Show MapEntry
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> MapEntry -> ShowS
showsPrec :: Int -> MapEntry -> ShowS
$cshow :: MapEntry -> String
show :: MapEntry -> String
$cshowList :: [MapEntry] -> ShowS
showList :: [MapEntry] -> ShowS
Show)
    deriving anyclass (HashMap Tag [WireField] -> Get MapEntry
(HashMap Tag [WireField] -> Get MapEntry) -> Decode MapEntry
forall a. (HashMap Tag [WireField] -> Get a) -> Decode a
$cdecode :: HashMap Tag [WireField] -> Get MapEntry
decode :: HashMap Tag [WireField] -> Get MapEntry
Decode, MapEntry -> Put
(MapEntry -> Put) -> Encode MapEntry
forall a. (a -> Put) -> Encode a
$cencode :: MapEntry -> Put
encode :: MapEntry -> Put
Encode)

newtype TermMap = TermMap
  { TermMap -> Repeated 1 (Message MapEntry)
map :: Repeated 1 (Message MapEntry)
  } deriving stock ((forall x. TermMap -> Rep TermMap x)
-> (forall x. Rep TermMap x -> TermMap) -> Generic TermMap
forall x. Rep TermMap x -> TermMap
forall x. TermMap -> Rep TermMap x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. TermMap -> Rep TermMap x
from :: forall x. TermMap -> Rep TermMap x
$cto :: forall x. Rep TermMap x -> TermMap
to :: forall x. Rep TermMap x -> TermMap
Generic, Int -> TermMap -> ShowS
[TermMap] -> ShowS
TermMap -> String
(Int -> TermMap -> ShowS)
-> (TermMap -> String) -> ([TermMap] -> ShowS) -> Show TermMap
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TermMap -> ShowS
showsPrec :: Int -> TermMap -> ShowS
$cshow :: TermMap -> String
show :: TermMap -> String
$cshowList :: [TermMap] -> ShowS
showList :: [TermMap] -> ShowS
Show)
    deriving anyclass (HashMap Tag [WireField] -> Get TermMap
(HashMap Tag [WireField] -> Get TermMap) -> Decode TermMap
forall a. (HashMap Tag [WireField] -> Get a) -> Decode a
$cdecode :: HashMap Tag [WireField] -> Get TermMap
decode :: HashMap Tag [WireField] -> Get TermMap
Decode, TermMap -> Put
(TermMap -> Put) -> Encode TermMap
forall a. (a -> Put) -> Encode a
$cencode :: TermMap -> Put
encode :: TermMap -> Put
Encode)

newtype Expression = Expression
  { Expression -> Repeated 1 (Message Op)
ops :: Repeated 1 (Message Op)
  } deriving stock ((forall x. Expression -> Rep Expression x)
-> (forall x. Rep Expression x -> Expression) -> Generic Expression
forall x. Rep Expression x -> Expression
forall x. Expression -> Rep Expression x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Expression -> Rep Expression x
from :: forall x. Expression -> Rep Expression x
$cto :: forall x. Rep Expression x -> Expression
to :: forall x. Rep Expression x -> Expression
Generic, Int -> Expression -> ShowS
[Expression] -> ShowS
Expression -> String
(Int -> Expression -> ShowS)
-> (Expression -> String)
-> ([Expression] -> ShowS)
-> Show Expression
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Expression -> ShowS
showsPrec :: Int -> Expression -> ShowS
$cshow :: Expression -> String
show :: Expression -> String
$cshowList :: [Expression] -> ShowS
showList :: [Expression] -> ShowS
Show)
    deriving anyclass (HashMap Tag [WireField] -> Get Expression
(HashMap Tag [WireField] -> Get Expression) -> Decode Expression
forall a. (HashMap Tag [WireField] -> Get a) -> Decode a
$cdecode :: HashMap Tag [WireField] -> Get Expression
decode :: HashMap Tag [WireField] -> Get Expression
Decode, Expression -> Put
(Expression -> Put) -> Encode Expression
forall a. (a -> Put) -> Encode a
$cencode :: Expression -> Put
encode :: Expression -> Put
Encode)

data Op =
    OpVValue  (Required 1 (Message Term))
  | OpVUnary  (Required 2 (Message OpUnary))
  | OpVBinary (Required 3 (Message OpBinary))
  | OpVClosure (Required 4 (Message OpClosure))
    deriving stock ((forall x. Op -> Rep Op x)
-> (forall x. Rep Op x -> Op) -> Generic Op
forall x. Rep Op x -> Op
forall x. Op -> Rep Op x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Op -> Rep Op x
from :: forall x. Op -> Rep Op x
$cto :: forall x. Rep Op x -> Op
to :: forall x. Rep Op x -> Op
Generic, Int -> Op -> ShowS
[Op] -> ShowS
Op -> String
(Int -> Op -> ShowS)
-> (Op -> String) -> ([Op] -> ShowS) -> Show Op
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Op -> ShowS
showsPrec :: Int -> Op -> ShowS
$cshow :: Op -> String
show :: Op -> String
$cshowList :: [Op] -> ShowS
showList :: [Op] -> ShowS
Show)
    deriving anyclass (HashMap Tag [WireField] -> Get Op
(HashMap Tag [WireField] -> Get Op) -> Decode Op
forall a. (HashMap Tag [WireField] -> Get a) -> Decode a
$cdecode :: HashMap Tag [WireField] -> Get Op
decode :: HashMap Tag [WireField] -> Get Op
Decode, Op -> Put
(Op -> Put) -> Encode Op
forall a. (a -> Put) -> Encode a
$cencode :: Op -> Put
encode :: Op -> Put
Encode)

data UnaryKind = Negate | Parens | Length | TypeOf | UnaryFfi
  deriving stock (Int -> UnaryKind -> ShowS
[UnaryKind] -> ShowS
UnaryKind -> String
(Int -> UnaryKind -> ShowS)
-> (UnaryKind -> String)
-> ([UnaryKind] -> ShowS)
-> Show UnaryKind
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> UnaryKind -> ShowS
showsPrec :: Int -> UnaryKind -> ShowS
$cshow :: UnaryKind -> String
show :: UnaryKind -> String
$cshowList :: [UnaryKind] -> ShowS
showList :: [UnaryKind] -> ShowS
Show, Int -> UnaryKind
UnaryKind -> Int
UnaryKind -> [UnaryKind]
UnaryKind -> UnaryKind
UnaryKind -> UnaryKind -> [UnaryKind]
UnaryKind -> UnaryKind -> UnaryKind -> [UnaryKind]
(UnaryKind -> UnaryKind)
-> (UnaryKind -> UnaryKind)
-> (Int -> UnaryKind)
-> (UnaryKind -> Int)
-> (UnaryKind -> [UnaryKind])
-> (UnaryKind -> UnaryKind -> [UnaryKind])
-> (UnaryKind -> UnaryKind -> [UnaryKind])
-> (UnaryKind -> UnaryKind -> UnaryKind -> [UnaryKind])
-> Enum UnaryKind
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: UnaryKind -> UnaryKind
succ :: UnaryKind -> UnaryKind
$cpred :: UnaryKind -> UnaryKind
pred :: UnaryKind -> UnaryKind
$ctoEnum :: Int -> UnaryKind
toEnum :: Int -> UnaryKind
$cfromEnum :: UnaryKind -> Int
fromEnum :: UnaryKind -> Int
$cenumFrom :: UnaryKind -> [UnaryKind]
enumFrom :: UnaryKind -> [UnaryKind]
$cenumFromThen :: UnaryKind -> UnaryKind -> [UnaryKind]
enumFromThen :: UnaryKind -> UnaryKind -> [UnaryKind]
$cenumFromTo :: UnaryKind -> UnaryKind -> [UnaryKind]
enumFromTo :: UnaryKind -> UnaryKind -> [UnaryKind]
$cenumFromThenTo :: UnaryKind -> UnaryKind -> UnaryKind -> [UnaryKind]
enumFromThenTo :: UnaryKind -> UnaryKind -> UnaryKind -> [UnaryKind]
Enum, UnaryKind
UnaryKind -> UnaryKind -> Bounded UnaryKind
forall a. a -> a -> Bounded a
$cminBound :: UnaryKind
minBound :: UnaryKind
$cmaxBound :: UnaryKind
maxBound :: UnaryKind
Bounded)

data OpUnary = OpUnary
  { OpUnary -> Required 1 (Enumeration UnaryKind)
kind    :: Required 1 (Enumeration UnaryKind)
  , OpUnary -> Optional 2 (Value Int64)
ffiName :: Optional 2 (Value Int64)
  } deriving stock ((forall x. OpUnary -> Rep OpUnary x)
-> (forall x. Rep OpUnary x -> OpUnary) -> Generic OpUnary
forall x. Rep OpUnary x -> OpUnary
forall x. OpUnary -> Rep OpUnary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. OpUnary -> Rep OpUnary x
from :: forall x. OpUnary -> Rep OpUnary x
$cto :: forall x. Rep OpUnary x -> OpUnary
to :: forall x. Rep OpUnary x -> OpUnary
Generic, Int -> OpUnary -> ShowS
[OpUnary] -> ShowS
OpUnary -> String
(Int -> OpUnary -> ShowS)
-> (OpUnary -> String) -> ([OpUnary] -> ShowS) -> Show OpUnary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> OpUnary -> ShowS
showsPrec :: Int -> OpUnary -> ShowS
$cshow :: OpUnary -> String
show :: OpUnary -> String
$cshowList :: [OpUnary] -> ShowS
showList :: [OpUnary] -> ShowS
Show)
    deriving anyclass (HashMap Tag [WireField] -> Get OpUnary
(HashMap Tag [WireField] -> Get OpUnary) -> Decode OpUnary
forall a. (HashMap Tag [WireField] -> Get a) -> Decode a
$cdecode :: HashMap Tag [WireField] -> Get OpUnary
decode :: HashMap Tag [WireField] -> Get OpUnary
Decode, OpUnary -> Put
(OpUnary -> Put) -> Encode OpUnary
forall a. (a -> Put) -> Encode a
$cencode :: OpUnary -> Put
encode :: OpUnary -> Put
Encode)

data BinaryKind =
    LessThan
  | GreaterThan
  | LessOrEqual
  | GreaterOrEqual
  | Equal
  | Contains
  | Prefix
  | Suffix
  | Regex
  | Add
  | Sub
  | Mul
  | Div
  | And
  | Or
  | Intersection
  | Union
  | BitwiseAnd
  | BitwiseOr
  | BitwiseXor
  | NotEqual
  | HeterogeneousEqual
  | HeterogeneousNotEqual
  | LazyAnd
  | LazyOr
  | All
  | Any
  | Get
  | BinaryFfi
  | TryOr
  deriving stock (Int -> BinaryKind -> ShowS
[BinaryKind] -> ShowS
BinaryKind -> String
(Int -> BinaryKind -> ShowS)
-> (BinaryKind -> String)
-> ([BinaryKind] -> ShowS)
-> Show BinaryKind
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BinaryKind -> ShowS
showsPrec :: Int -> BinaryKind -> ShowS
$cshow :: BinaryKind -> String
show :: BinaryKind -> String
$cshowList :: [BinaryKind] -> ShowS
showList :: [BinaryKind] -> ShowS
Show, Int -> BinaryKind
BinaryKind -> Int
BinaryKind -> [BinaryKind]
BinaryKind -> BinaryKind
BinaryKind -> BinaryKind -> [BinaryKind]
BinaryKind -> BinaryKind -> BinaryKind -> [BinaryKind]
(BinaryKind -> BinaryKind)
-> (BinaryKind -> BinaryKind)
-> (Int -> BinaryKind)
-> (BinaryKind -> Int)
-> (BinaryKind -> [BinaryKind])
-> (BinaryKind -> BinaryKind -> [BinaryKind])
-> (BinaryKind -> BinaryKind -> [BinaryKind])
-> (BinaryKind -> BinaryKind -> BinaryKind -> [BinaryKind])
-> Enum BinaryKind
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: BinaryKind -> BinaryKind
succ :: BinaryKind -> BinaryKind
$cpred :: BinaryKind -> BinaryKind
pred :: BinaryKind -> BinaryKind
$ctoEnum :: Int -> BinaryKind
toEnum :: Int -> BinaryKind
$cfromEnum :: BinaryKind -> Int
fromEnum :: BinaryKind -> Int
$cenumFrom :: BinaryKind -> [BinaryKind]
enumFrom :: BinaryKind -> [BinaryKind]
$cenumFromThen :: BinaryKind -> BinaryKind -> [BinaryKind]
enumFromThen :: BinaryKind -> BinaryKind -> [BinaryKind]
$cenumFromTo :: BinaryKind -> BinaryKind -> [BinaryKind]
enumFromTo :: BinaryKind -> BinaryKind -> [BinaryKind]
$cenumFromThenTo :: BinaryKind -> BinaryKind -> BinaryKind -> [BinaryKind]
enumFromThenTo :: BinaryKind -> BinaryKind -> BinaryKind -> [BinaryKind]
Enum, BinaryKind
BinaryKind -> BinaryKind -> Bounded BinaryKind
forall a. a -> a -> Bounded a
$cminBound :: BinaryKind
minBound :: BinaryKind
$cmaxBound :: BinaryKind
maxBound :: BinaryKind
Bounded)

data OpBinary = OpBinary
  { OpBinary -> Required 1 (Enumeration BinaryKind)
kind    :: Required 1 (Enumeration BinaryKind)
  , OpBinary -> Optional 2 (Value Int64)
ffiName :: Optional 2 (Value Int64)
  } deriving stock ((forall x. OpBinary -> Rep OpBinary x)
-> (forall x. Rep OpBinary x -> OpBinary) -> Generic OpBinary
forall x. Rep OpBinary x -> OpBinary
forall x. OpBinary -> Rep OpBinary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. OpBinary -> Rep OpBinary x
from :: forall x. OpBinary -> Rep OpBinary x
$cto :: forall x. Rep OpBinary x -> OpBinary
to :: forall x. Rep OpBinary x -> OpBinary
Generic, Int -> OpBinary -> ShowS
[OpBinary] -> ShowS
OpBinary -> String
(Int -> OpBinary -> ShowS)
-> (OpBinary -> String) -> ([OpBinary] -> ShowS) -> Show OpBinary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> OpBinary -> ShowS
showsPrec :: Int -> OpBinary -> ShowS
$cshow :: OpBinary -> String
show :: OpBinary -> String
$cshowList :: [OpBinary] -> ShowS
showList :: [OpBinary] -> ShowS
Show)
    deriving anyclass (HashMap Tag [WireField] -> Get OpBinary
(HashMap Tag [WireField] -> Get OpBinary) -> Decode OpBinary
forall a. (HashMap Tag [WireField] -> Get a) -> Decode a
$cdecode :: HashMap Tag [WireField] -> Get OpBinary
decode :: HashMap Tag [WireField] -> Get OpBinary
Decode, OpBinary -> Put
(OpBinary -> Put) -> Encode OpBinary
forall a. (a -> Put) -> Encode a
$cencode :: OpBinary -> Put
encode :: OpBinary -> Put
Encode)

data OpClosure = OpClosure
  { OpClosure -> Repeated 1 (Value Int64)
params :: Repeated 1 (Value Int64)
  , OpClosure -> Repeated 2 (Message Op)
ops    :: Repeated 2 (Message Op)
  } deriving stock ((forall x. OpClosure -> Rep OpClosure x)
-> (forall x. Rep OpClosure x -> OpClosure) -> Generic OpClosure
forall x. Rep OpClosure x -> OpClosure
forall x. OpClosure -> Rep OpClosure x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. OpClosure -> Rep OpClosure x
from :: forall x. OpClosure -> Rep OpClosure x
$cto :: forall x. Rep OpClosure x -> OpClosure
to :: forall x. Rep OpClosure x -> OpClosure
Generic, Int -> OpClosure -> ShowS
[OpClosure] -> ShowS
OpClosure -> String
(Int -> OpClosure -> ShowS)
-> (OpClosure -> String)
-> ([OpClosure] -> ShowS)
-> Show OpClosure
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> OpClosure -> ShowS
showsPrec :: Int -> OpClosure -> ShowS
$cshow :: OpClosure -> String
show :: OpClosure -> String
$cshowList :: [OpClosure] -> ShowS
showList :: [OpClosure] -> ShowS
Show)
    deriving anyclass (HashMap Tag [WireField] -> Get OpClosure
(HashMap Tag [WireField] -> Get OpClosure) -> Decode OpClosure
forall a. (HashMap Tag [WireField] -> Get a) -> Decode a
$cdecode :: HashMap Tag [WireField] -> Get OpClosure
decode :: HashMap Tag [WireField] -> Get OpClosure
Decode, OpClosure -> Put
(OpClosure -> Put) -> Encode OpClosure
forall a. (a -> Put) -> Encode a
$cencode :: OpClosure -> Put
encode :: OpClosure -> Put
Encode)

decodeBlockList :: ByteString
                -> Either String Biscuit
decodeBlockList :: ByteString -> Either String Biscuit
decodeBlockList = Get Biscuit -> ByteString -> Either String Biscuit
forall a. Get a -> ByteString -> Either String a
runGet Get Biscuit
forall a. Decode a => Get a
decodeMessage

decodeBlock :: ByteString
            -> Either String Block
decodeBlock :: ByteString -> Either String Block
decodeBlock = Get Block -> ByteString -> Either String Block
forall a. Get a -> ByteString -> Either String a
runGet Get Block
forall a. Decode a => Get a
decodeMessage

encodeBlockList :: Biscuit -> ByteString
encodeBlockList :: Biscuit -> ByteString
encodeBlockList = Put -> ByteString
runPut (Put -> ByteString) -> (Biscuit -> Put) -> Biscuit -> ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Biscuit -> Put
forall a. Encode a => a -> Put
encodeMessage

encodeBlock :: Block -> ByteString
encodeBlock :: Block -> ByteString
encodeBlock = Put -> ByteString
runPut (Put -> ByteString) -> (Block -> Put) -> Block -> ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Block -> Put
forall a. Encode a => a -> Put
encodeMessage

encodeThirdPartyBlockRequest :: ThirdPartyBlockRequest -> ByteString
encodeThirdPartyBlockRequest :: ThirdPartyBlockRequest -> ByteString
encodeThirdPartyBlockRequest = Put -> ByteString
runPut (Put -> ByteString)
-> (ThirdPartyBlockRequest -> Put)
-> ThirdPartyBlockRequest
-> ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ThirdPartyBlockRequest -> Put
forall a. Encode a => a -> Put
encodeMessage

encodeThirdPartyBlockContents :: ThirdPartyBlockContents -> ByteString
encodeThirdPartyBlockContents :: ThirdPartyBlockContents -> ByteString
encodeThirdPartyBlockContents = Put -> ByteString
runPut (Put -> ByteString)
-> (ThirdPartyBlockContents -> Put)
-> ThirdPartyBlockContents
-> ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ThirdPartyBlockContents -> Put
forall a. Encode a => a -> Put
encodeMessage

decodeThirdPartyBlockRequest :: ByteString -> Either String ThirdPartyBlockRequest
decodeThirdPartyBlockRequest :: ByteString -> Either String ThirdPartyBlockRequest
decodeThirdPartyBlockRequest = Get ThirdPartyBlockRequest
-> ByteString -> Either String ThirdPartyBlockRequest
forall a. Get a -> ByteString -> Either String a
runGet Get ThirdPartyBlockRequest
forall a. Decode a => Get a
decodeMessage

decodeThirdPartyBlockContents :: ByteString -> Either String ThirdPartyBlockContents
decodeThirdPartyBlockContents :: ByteString -> Either String ThirdPartyBlockContents
decodeThirdPartyBlockContents = Get ThirdPartyBlockContents
-> ByteString -> Either String ThirdPartyBlockContents
forall a. Get a -> ByteString -> Either String a
runGet Get ThirdPartyBlockContents
forall a. Decode a => Get a
decodeMessage

data ThirdPartyBlockRequest
  = ThirdPartyBlockRequest
  { ThirdPartyBlockRequest -> Optional 1 (Message PublicKey)
legacyPk :: Optional 1 (Message PublicKey)
  , ThirdPartyBlockRequest -> Repeated 2 (Message PublicKey)
pkTable  :: Repeated 2 (Message PublicKey)
  , ThirdPartyBlockRequest -> Required 3 (Value ByteString)
prevSig  :: Required 3 (Value ByteString)
  } deriving stock ((forall x. ThirdPartyBlockRequest -> Rep ThirdPartyBlockRequest x)
-> (forall x.
    Rep ThirdPartyBlockRequest x -> ThirdPartyBlockRequest)
-> Generic ThirdPartyBlockRequest
forall x. Rep ThirdPartyBlockRequest x -> ThirdPartyBlockRequest
forall x. ThirdPartyBlockRequest -> Rep ThirdPartyBlockRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ThirdPartyBlockRequest -> Rep ThirdPartyBlockRequest x
from :: forall x. ThirdPartyBlockRequest -> Rep ThirdPartyBlockRequest x
$cto :: forall x. Rep ThirdPartyBlockRequest x -> ThirdPartyBlockRequest
to :: forall x. Rep ThirdPartyBlockRequest x -> ThirdPartyBlockRequest
Generic, Int -> ThirdPartyBlockRequest -> ShowS
[ThirdPartyBlockRequest] -> ShowS
ThirdPartyBlockRequest -> String
(Int -> ThirdPartyBlockRequest -> ShowS)
-> (ThirdPartyBlockRequest -> String)
-> ([ThirdPartyBlockRequest] -> ShowS)
-> Show ThirdPartyBlockRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ThirdPartyBlockRequest -> ShowS
showsPrec :: Int -> ThirdPartyBlockRequest -> ShowS
$cshow :: ThirdPartyBlockRequest -> String
show :: ThirdPartyBlockRequest -> String
$cshowList :: [ThirdPartyBlockRequest] -> ShowS
showList :: [ThirdPartyBlockRequest] -> ShowS
Show)
    deriving anyclass (HashMap Tag [WireField] -> Get ThirdPartyBlockRequest
(HashMap Tag [WireField] -> Get ThirdPartyBlockRequest)
-> Decode ThirdPartyBlockRequest
forall a. (HashMap Tag [WireField] -> Get a) -> Decode a
$cdecode :: HashMap Tag [WireField] -> Get ThirdPartyBlockRequest
decode :: HashMap Tag [WireField] -> Get ThirdPartyBlockRequest
Decode, ThirdPartyBlockRequest -> Put
(ThirdPartyBlockRequest -> Put) -> Encode ThirdPartyBlockRequest
forall a. (a -> Put) -> Encode a
$cencode :: ThirdPartyBlockRequest -> Put
encode :: ThirdPartyBlockRequest -> Put
Encode)

data ThirdPartyBlockContents
  = ThirdPartyBlockContents
  { ThirdPartyBlockContents -> Required 1 (Value ByteString)
payload     :: Required 1 (Value ByteString)
  , ThirdPartyBlockContents -> Required 2 (Message ExternalSig)
externalSig :: Required 2 (Message ExternalSig)
  } deriving stock ((forall x.
 ThirdPartyBlockContents -> Rep ThirdPartyBlockContents x)
-> (forall x.
    Rep ThirdPartyBlockContents x -> ThirdPartyBlockContents)
-> Generic ThirdPartyBlockContents
forall x. Rep ThirdPartyBlockContents x -> ThirdPartyBlockContents
forall x. ThirdPartyBlockContents -> Rep ThirdPartyBlockContents x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ThirdPartyBlockContents -> Rep ThirdPartyBlockContents x
from :: forall x. ThirdPartyBlockContents -> Rep ThirdPartyBlockContents x
$cto :: forall x. Rep ThirdPartyBlockContents x -> ThirdPartyBlockContents
to :: forall x. Rep ThirdPartyBlockContents x -> ThirdPartyBlockContents
Generic, Int -> ThirdPartyBlockContents -> ShowS
[ThirdPartyBlockContents] -> ShowS
ThirdPartyBlockContents -> String
(Int -> ThirdPartyBlockContents -> ShowS)
-> (ThirdPartyBlockContents -> String)
-> ([ThirdPartyBlockContents] -> ShowS)
-> Show ThirdPartyBlockContents
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ThirdPartyBlockContents -> ShowS
showsPrec :: Int -> ThirdPartyBlockContents -> ShowS
$cshow :: ThirdPartyBlockContents -> String
show :: ThirdPartyBlockContents -> String
$cshowList :: [ThirdPartyBlockContents] -> ShowS
showList :: [ThirdPartyBlockContents] -> ShowS
Show)
    deriving anyclass (HashMap Tag [WireField] -> Get ThirdPartyBlockContents
(HashMap Tag [WireField] -> Get ThirdPartyBlockContents)
-> Decode ThirdPartyBlockContents
forall a. (HashMap Tag [WireField] -> Get a) -> Decode a
$cdecode :: HashMap Tag [WireField] -> Get ThirdPartyBlockContents
decode :: HashMap Tag [WireField] -> Get ThirdPartyBlockContents
Decode, ThirdPartyBlockContents -> Put
(ThirdPartyBlockContents -> Put) -> Encode ThirdPartyBlockContents
forall a. (a -> Put) -> Encode a
$cencode :: ThirdPartyBlockContents -> Put
encode :: ThirdPartyBlockContents -> Put
Encode)