{-# LANGUAGE DataKinds             #-}
{-# LANGUAGE DeriveAnyClass        #-}
{-# LANGUAGE DeriveGeneric         #-}
{-# LANGUAGE DerivingStrategies    #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-|
  Module      : Auth.Biscuit.Proto
  Copyright   : © Clément Delafargue, 2021
  License     : MIT
  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 (..)
  , FactV2 (..)
  , RuleV2 (..)
  , CheckKind (..)
  , CheckV2 (..)
  , PredicateV2 (..)
  , TermV2 (..)
  , ExpressionV2 (..)
  , TermSet (..)
  , Op (..)
  , OpUnary (..)
  , UnaryKind (..)
  , OpBinary (..)
  , BinaryKind (..)
  , OpTernary (..)
  , TernaryKind (..)
  , 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)
  }
  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 FactV2)
facts_v2  :: Repeated 4 (Message FactV2)
  , Block -> Repeated 5 (Message RuleV2)
rules_v2  :: Repeated 5 (Message RuleV2)
  , Block -> Repeated 6 (Message CheckV2)
checks_v2 :: Repeated 6 (Message CheckV2)
  , 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 FactV2 = FactV2
  { FactV2 -> Required 1 (Message PredicateV2)
predicate :: Required 1 (Message PredicateV2)
  } deriving stock ((forall x. FactV2 -> Rep FactV2 x)
-> (forall x. Rep FactV2 x -> FactV2) -> Generic FactV2
forall x. Rep FactV2 x -> FactV2
forall x. FactV2 -> Rep FactV2 x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. FactV2 -> Rep FactV2 x
from :: forall x. FactV2 -> Rep FactV2 x
$cto :: forall x. Rep FactV2 x -> FactV2
to :: forall x. Rep FactV2 x -> FactV2
Generic, Int -> FactV2 -> ShowS
[FactV2] -> ShowS
FactV2 -> String
(Int -> FactV2 -> ShowS)
-> (FactV2 -> String) -> ([FactV2] -> ShowS) -> Show FactV2
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FactV2 -> ShowS
showsPrec :: Int -> FactV2 -> ShowS
$cshow :: FactV2 -> String
show :: FactV2 -> String
$cshowList :: [FactV2] -> ShowS
showList :: [FactV2] -> ShowS
Show)
    deriving anyclass (HashMap Tag [WireField] -> Get FactV2
(HashMap Tag [WireField] -> Get FactV2) -> Decode FactV2
forall a. (HashMap Tag [WireField] -> Get a) -> Decode a
$cdecode :: HashMap Tag [WireField] -> Get FactV2
decode :: HashMap Tag [WireField] -> Get FactV2
Decode, FactV2 -> Put
(FactV2 -> Put) -> Encode FactV2
forall a. (a -> Put) -> Encode a
$cencode :: FactV2 -> Put
encode :: FactV2 -> Put
Encode)

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

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

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

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


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

data Op =
    OpVValue  (Required 1 (Message TermV2))
  | OpVUnary  (Required 2 (Message OpUnary))
  | OpVBinary (Required 3 (Message OpBinary))
    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
  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)

newtype OpUnary = OpUnary
  { OpUnary -> Required 1 (Enumeration UnaryKind)
kind :: Required 1 (Enumeration UnaryKind)
  } 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
  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)

newtype OpBinary = OpBinary
  { OpBinary -> Required 1 (Enumeration BinaryKind)
kind :: Required 1 (Enumeration BinaryKind)
  } 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 TernaryKind =
    VerifyEd25519Signature
  deriving stock (Int -> TernaryKind -> ShowS
[TernaryKind] -> ShowS
TernaryKind -> String
(Int -> TernaryKind -> ShowS)
-> (TernaryKind -> String)
-> ([TernaryKind] -> ShowS)
-> Show TernaryKind
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TernaryKind -> ShowS
showsPrec :: Int -> TernaryKind -> ShowS
$cshow :: TernaryKind -> String
show :: TernaryKind -> String
$cshowList :: [TernaryKind] -> ShowS
showList :: [TernaryKind] -> ShowS
Show, Int -> TernaryKind
TernaryKind -> Int
TernaryKind -> [TernaryKind]
TernaryKind -> TernaryKind
TernaryKind -> TernaryKind -> [TernaryKind]
TernaryKind -> TernaryKind -> TernaryKind -> [TernaryKind]
(TernaryKind -> TernaryKind)
-> (TernaryKind -> TernaryKind)
-> (Int -> TernaryKind)
-> (TernaryKind -> Int)
-> (TernaryKind -> [TernaryKind])
-> (TernaryKind -> TernaryKind -> [TernaryKind])
-> (TernaryKind -> TernaryKind -> [TernaryKind])
-> (TernaryKind -> TernaryKind -> TernaryKind -> [TernaryKind])
-> Enum TernaryKind
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 :: TernaryKind -> TernaryKind
succ :: TernaryKind -> TernaryKind
$cpred :: TernaryKind -> TernaryKind
pred :: TernaryKind -> TernaryKind
$ctoEnum :: Int -> TernaryKind
toEnum :: Int -> TernaryKind
$cfromEnum :: TernaryKind -> Int
fromEnum :: TernaryKind -> Int
$cenumFrom :: TernaryKind -> [TernaryKind]
enumFrom :: TernaryKind -> [TernaryKind]
$cenumFromThen :: TernaryKind -> TernaryKind -> [TernaryKind]
enumFromThen :: TernaryKind -> TernaryKind -> [TernaryKind]
$cenumFromTo :: TernaryKind -> TernaryKind -> [TernaryKind]
enumFromTo :: TernaryKind -> TernaryKind -> [TernaryKind]
$cenumFromThenTo :: TernaryKind -> TernaryKind -> TernaryKind -> [TernaryKind]
enumFromThenTo :: TernaryKind -> TernaryKind -> TernaryKind -> [TernaryKind]
Enum, TernaryKind
TernaryKind -> TernaryKind -> Bounded TernaryKind
forall a. a -> a -> Bounded a
$cminBound :: TernaryKind
minBound :: TernaryKind
$cmaxBound :: TernaryKind
maxBound :: TernaryKind
Bounded)

newtype OpTernary = OpTernary
  { OpTernary -> Required 1 (Enumeration TernaryKind)
kind :: Required 1 (Enumeration TernaryKind)
  } deriving stock ((forall x. OpTernary -> Rep OpTernary x)
-> (forall x. Rep OpTernary x -> OpTernary) -> Generic OpTernary
forall x. Rep OpTernary x -> OpTernary
forall x. OpTernary -> Rep OpTernary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. OpTernary -> Rep OpTernary x
from :: forall x. OpTernary -> Rep OpTernary x
$cto :: forall x. Rep OpTernary x -> OpTernary
to :: forall x. Rep OpTernary x -> OpTernary
Generic, Int -> OpTernary -> ShowS
[OpTernary] -> ShowS
OpTernary -> String
(Int -> OpTernary -> ShowS)
-> (OpTernary -> String)
-> ([OpTernary] -> ShowS)
-> Show OpTernary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> OpTernary -> ShowS
showsPrec :: Int -> OpTernary -> ShowS
$cshow :: OpTernary -> String
show :: OpTernary -> String
$cshowList :: [OpTernary] -> ShowS
showList :: [OpTernary] -> ShowS
Show)
    deriving anyclass (HashMap Tag [WireField] -> Get OpTernary
(HashMap Tag [WireField] -> Get OpTernary) -> Decode OpTernary
forall a. (HashMap Tag [WireField] -> Get a) -> Decode a
$cdecode :: HashMap Tag [WireField] -> Get OpTernary
decode :: HashMap Tag [WireField] -> Get OpTernary
Decode, OpTernary -> Put
(OpTernary -> Put) -> Encode OpTernary
forall a. (a -> Put) -> Encode a
$cencode :: OpTernary -> Put
encode :: OpTernary -> 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 -> Required 1 (Message PublicKey)
previousPk :: Required 1 (Message PublicKey)
  , ThirdPartyBlockRequest -> Repeated 2 (Message PublicKey)
pkTable    :: Repeated 2 (Message PublicKey)
  } 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)