// package: ocap
// file: trace-type.proto

import * as google_protobuf_any_pb from "google-protobuf/google/protobuf/any_pb";
import * as type_pb from "./type_pb";
import * as state_pb from "./state_pb";
import * as enum_pb from "./enum_pb";
import * as tx_pb from "./tx_pb";

export type TPageOrder = {
  field: string,
  type: string,
}

export type TPage = {
  cursor: string,
  size: number,
  order: Array<TPageOrder>,
}

export type TTypeFilter = {
  types: Array<string>,
}

export type TAssetFilter = {
  assets: Array<string>,
}

export type TFactoryFilter = {
  factories: Array<string>,
}

export type TDelegationFilter = {
  delegations: Array<string>,
}

export type TTokenFilter = {
  tokens: Array<string>,
}

export type TStakeFilter = {
  stakes: Array<string>,
}

export type TAccountFilter = {
  accounts: Array<string>,
}

export type TTxFilter = {
  txs: Array<string>,
}

export type TRollupFilter = {
  rollups: Array<string>,
}

export type TValidatorFilter = {
  validators: Array<string>,
}

export type TTokenFactoryFilter = {
  tokenFactories: Array<string>,
}

export type TTimeFilter = {
  startDateTime: string,
  endDateTime: string,
  field: string,
}

export type TAddressFilter = {
  sender: string,
  receiver: string,
  direction: DirectionMap[keyof DirectionMap],
}

export type TPageInfo = {
  cursor: string,
  next: boolean,
  total: number,
}

export type TTokenMeta = {
  address: string,
  balance: string,
  decimal: number,
  unit: string,
  symbol: string,
}

export type TValidityFilter = {
  validity: ValidityMap[keyof ValidityMap],
}

export type TRangeFilter = {
  from: string,
  to: string,
}

export type TAccountToken = {
  address: string,
  symbol: string,
  balance: string,
  decimal: number,
}

export type TByDay = {
  startDate: string,
  endDate: string,
}

export type TByHour = {
  date: string,
}

export type TIndexedTransaction = {
  hash: string,
  sender: string,
  receiver: string,
  time: string,
  type: string,
  tx?: type_pb.TTransaction,
  valid: boolean,
  code: enum_pb.StatusCodeMap[keyof enum_pb.StatusCodeMap],
  tokenSymbols: Array<TTokenMeta>,
  receipts: Array<type_pb.TTransactionReceipt>,
}

export type TIndexedAccountState = {
  address: string,
  balance?: type_pb.TBigUint,
  numAssets: string,
  numTxs: string,
  nonce: string,
  genesisTime: string,
  renaissanceTime: string,
  moniker: string,
  migratedFrom: string,
  migratedTo: string,
  totalReceivedStakes?: type_pb.TBigUint,
  totalStakes?: type_pb.TBigUint,
  totalUnstakes?: type_pb.TBigUint,
  recentNumTxs: Array<string>,
  tokens: Array<TTokenMeta>,
}

export type TIndexedAssetState = {
  address: string,
  owner: string,
  genesisTime: string,
  renaissanceTime: string,
  moniker: string,
  readonly: boolean,
  consumedTime: string,
  issuer: string,
  parent: string,
  transferrable: boolean,
  ttl: string,
  display?: type_pb.TNFTDisplay,
  endpoint?: type_pb.TNFTEndpoint,
  tags: Array<string>,
  data?: google_protobuf_any_pb.Any,
}

export type TIndexedBlock = {
  height: string,
  time: string,
  proposer: string,
  numTxs: string,
  numInvalidTxs: string,
}

export type TIndexedTokenState = {
  name: string,
  description: string,
  symbol: string,
  unit: string,
  decimal: number,
  issuer: string,
  icon: string,
  totalSupply: string,
  address: string,
  genesisTime: string,
  renaissanceTime: string,
  foreignToken?: type_pb.TForeignToken,
  tokenFactoryAddress: string,
  maxTotalSupply: string,
  initialSupply: string,
  metadata?: google_protobuf_any_pb.Any,
  website: string,
  spenders: Array<string>,
  minters: Array<string>,
  type: string,
  data?: google_protobuf_any_pb.Any,
}

export type TIndexedTokenFactoryState = {
  address: string,
  owner: string,
  tokenAddress: string,
  reserveAddress: string,
  curve?: type_pb.TCurveConfig,
  feeRate: number,
  currentSupply: string,
  reserveBalance: string,
  status: string,
  genesisTime: string,
  renaissanceTime: string,
  token?: type_pb.TIndexedTokenInput,
  reserveToken?: type_pb.TIndexedTokenInput,
  data?: google_protobuf_any_pb.Any,
}

export type TIndexedFactoryState = {
  address: string,
  owner: string,
  name: string,
  description: string,
  settlement: string,
  limit: string,
  trustedIssuers: Array<string>,
  input?: type_pb.TIndexedFactoryInput,
  output?: tx_pb.TCreateAssetTx,
  hooks: Array<type_pb.TAssetFactoryHook>,
  data?: google_protobuf_any_pb.Any,
  balance: string,
  tokens: Array<TTokenMeta>,
  numMinted: number,
  lastSettlement: string,
  genesisTime: string,
  renaissanceTime: string,
  display?: type_pb.TNFTDisplay,
}

export type TIndexedStakeState = {
  address: string,
  sender: string,
  receiver: string,
  tokens: Array<TTokenMeta>,
  assets: Array<string>,
  revocable: boolean,
  genesisTime: string,
  renaissanceTime: string,
  message: string,
  revokeWaitingPeriod: number,
  revokedTokens: Array<TTokenMeta>,
  revokedAssets: Array<string>,
  slashers: Array<string>,
  nonce: string,
  data?: google_protobuf_any_pb.Any,
}

export type TIndexedRollupState = {
  address: string,
  tokenAddress: string,
  vaultAddress: string,
  contractAddress: string,
  seedValidators: Array<type_pb.TRollupValidator>,
  validators: Array<type_pb.TRollupValidator>,
  minStakeAmount: string,
  maxStakeAmount: string,
  minSignerCount: number,
  maxSignerCount: number,
  minBlockSize: number,
  maxBlockSize: number,
  minBlockInterval: number,
  genesisTime: string,
  renaissanceTime: string,
  tokenInfo?: type_pb.TIndexedTokenInput,
  issuer: string,
  depositFeeRate: number,
  withdrawFeeRate: number,
  proposerFeeShare: number,
  minDepositAmount: string,
  minWithdrawAmount: string,
  blockHeight: number,
  blockHash: string,
  minBlockConfirmation: number,
  totalDepositAmount: string,
  totalWithdrawAmount: string,
  maxDepositAmount: string,
  maxWithdrawAmount: string,
  minDepositFee: string,
  maxDepositFee: string,
  minWithdrawFee: string,
  maxWithdrawFee: string,
  paused: boolean,
  foreignToken?: type_pb.TForeignToken,
  leaveWaitingPeriod: number,
  publisherFeeShare: number,
  publishWaitingPeriod: number,
  publishSlashRate: number,
  migrateHistory: Array<string>,
  closed: boolean,
  vaultHistory: Array<string>,
  data?: google_protobuf_any_pb.Any,
}

export type TIndexedRollupBlock = {
  hash: string,
  height: number,
  merkleRoot: string,
  previousHash: string,
  txsHash: string,
  txs: Array<string>,
  proposer: string,
  signatures: Array<type_pb.TMultisig>,
  genesisTime: string,
  renaissanceTime: string,
  rollup: string,
  mintedAmount: string,
  burnedAmount: string,
  rewardAmount: string,
  governance: boolean,
  tokenInfo?: type_pb.TIndexedTokenInput,
  data?: google_protobuf_any_pb.Any,
}

export type TSearchResult = {
  type: string,
  id: string,
  title: string,
  subtitle: string,
  description: string,
  tags: Array<string>,
  timestamp: string,
}

export type TIndexedRollupValidator = {
  pk: string,
  address: string,
  moniker: string,
  endpoint: string,
  joinTime: string,
  leaveTime: string,
  genesisTime: string,
  renaissanceTime: string,
  totalStake: string,
  revokedStake: string,
  availableStake: string,
  totalGain: string,
  proposedBlockCount: number,
  verifiedBlockCount: number,
  latestBlockHeight: number,
  latestBlockHash: string,
  rollup: string,
}

export type TIndexedDelegationState = {
  address: string,
  from: string,
  to: string,
  genesisTime: string,
  renaissanceTime: string,
  opsMap: Array<[string, state_pb.TDelegateOpState]>,
  data?: google_protobuf_any_pb.Any,
}

export type TIndexedTokenFlow = {
  value: string,
  hash: string,
  from: string,
  to: string,
}

export type TVerifyAccountRiskResult = {
  isRisky: boolean,
  reason: string,
  data?: VerifyAccountRiskResult.TBalanceRisky,
}

  export class BalanceRisky extends jspb.Message {
    getAddress(): string;
    setAddress(value: string): void;

    getBalance(): string;
    setBalance(value: string): void;

    getTransferIn(): string;
    setTransferIn(value: string): void;

    getTransferOut(): string;
    setTransferOut(value: string): void;

    getAccountCount(): number;
    setAccountCount(value: number): void;

    getTxCount(): number;
    setTxCount(value: number): void;

    serializeBinary(): Uint8Array;
    toObject(includeInstance?: boolean): TBalanceRisky;
    static toObject(includeInstance: boolean, msg: BalanceRisky): TBalanceRisky;
    static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
    static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
    static serializeBinaryToWriter(message: BalanceRisky, writer: jspb.BinaryWriter): void;
    static deserializeBinary(bytes: Uint8Array): BalanceRisky;
    static deserializeBinaryFromReader(message: BalanceRisky, reader: jspb.BinaryReader): BalanceRisky;
  }

  export type TBalanceRisky = {
    address: string,
    balance: string,
    transferIn: string,
    transferOut: string,
    accountCount: number,
    txCount: number,
  }

export type TTokenDistribution = {
  tokenAddress: string,
  txTime: string,
  account: string,
  gas: string,
  fee: string,
  slashedVault: string,
  stake: string,
  revokedStake: string,
  gasStake: string,
}

export interface DirectionMap {
  MUTUAL: 0;
  ONE_WAY: 1;
  UNION: 2;
}

export const Direction: DirectionMap;

export interface ValidityMap {
  BOTH: 0;
  VALID: 1;
  INVALID: 2;
}

export const Validity: ValidityMap;

export interface TokenFlowDirectionMap {
  IN: 0;
  OUT: 1;
}

export const TokenFlowDirection: TokenFlowDirectionMap;
