// core/types/interfaces/index.ts
//
// NOTE: Proto types (T*) are exported directly from core/types/index.d.ts via lib/*_pb.d.ts
// This file only exports interface types (I*) that extend or complement proto types
// DO NOT re-export proto types here to avoid "already exported" errors

// Base types
export type {
  BN,
  BaseBN,
  Promisable,
  BytesType,
  Timestamp,
  Address,
  Hash,
  IAny,
  PartialBy,
  RequiredBy,
  DeepPartial,
  RequiredFields,
  NonNullableFields,
} from './base';

// State types (extended Proto T*State interfaces)
export type {
  IStateContext,
  IStateContextInput,
  IState,
  IStateWithOwner,
  StateChangeType,
  StateKind,
  IStateChangeEvent,
  TokenBalanceMap,
  // Account and Asset
  IAccountState,
  IAssetState,
  IForeignToken,
  ITokenMetadata,
  ITokenState,
  // Factory types
  IFactoryHook,
  IFactoryInput,
  IAssetFactoryState,
  IStakeState,
  // Delegation types
  IDelegationTokenLimit,
  IDelegationAssetLimit,
  IDelegationOpLimit,
  IDelegationOps,
  IDelegateState,
  // Rollup types
  IRollupValidator,
  IRollupState,
  IBlockSignature,
  IRollupBlock,
  IEvidenceState,
  ITokenFactoryCurve,
  ITokenFactoryState,
} from './state';

// Config types (interface types only - proto types exported from lib/*_pb.d.ts)
export type {
  // Config-specific types
  TxTypeUrl,
  TxTypeMap,
  // Extended types
  IAccountConfig,
  ITxGasConfig,
  ITxStakeConfig,
  ITransactionConfig,
  ITokenConfig,
  IVaultsConfig,
  IConsensusConfig,
  // Composite types
  IDefaultConfig,
  IChainConfig,
  IChainConfigInput,
  ITokenItx,
} from './config';

// StateDB
export type {
  HookFunction,
  StateEventHandler,
  IOperationContext,
  IChainTokenInfo,
  IChainState,
  ITxData,
  ITxState,
  IBalanceState,
  IStateTable,
  IBalanceTable,
  ITokenTable,
  IRollupTable,
  IReady,
  IStateDB,
  StateDBTableName,
} from './statedb';

// IndexDB (interface types only - proto types T* exported from lib/*_pb.d.ts)
export type {
  // Token format conversion types
  TokenConversionInput,
  // Unified indexed state type (local union type)
  TIndexedState,
  // IndexDB type mappings
  IndexTableTypeMap,
  IndexTableType,
  IndexedTypeFor,
  // State to indexed type mappings
  StateToIndexedMap,
  StateTypeOf,
  IndexedTypeOf,
  // IIndexTable interface
  IndexTableHookFn,
  IIndexTable,
  // List result types
  IListTransactionsResult,
  IListAssetsResult,
  IListAccountsResult,
  IListTokensResult,
  IListFactoriesResult,
  IListStakesResult,
  IListDelegationsResult,
  IListRollupsResult,
  IListRollupBlocksResult,
  IListRollupValidatorsResult,
  IListTokenFactoriesResult,
  ListResultTypeMap,
  ListResultFor,
  // IIndexDB interface
  IIndexDB,
} from './indexdb';

// Pipeline context types
export type {
  // Common interfaces
  IPipelineLogger,
  IDecodedTransaction,
  IMultiSigData,
  IAccountUpdate,
  ILockedState,
  IInputChange,
  IValidatedItx,
  IGasStake,
  ITokenCondition,
  IOutput,
  IInput,
  // Phase context types (new 5-phase hierarchy)
  IBaseContext,
  ITxOnlyContext,
  IDecodedContext,
  IGasContext,
  IReadyContext,
  IExecutedContext,
  // Mixin interfaces: Account states
  IWithSender,
  IWithReceiver,
  IWithDelegator,
  IWithDelegators,
  IWithOwner,
  IWithIssuer,
  IWithIssuers,
  IWithLocker,
  IWithSigners,
  IWithReceivers,
  IWithSenders,
  // Mixin interfaces: Protocol states
  IWithAsset,
  IWithAssets,
  IWithToken,
  IWithTokens,
  IWithFactory,
  IWithTokenFactory,
  IWithStake,
  IWithStakes,
  IWithDelegation,
  IWithRollup,
  IWithRollupBlock,
  IWithEvidence,
  IWithLocked,
  FinalizedContext,
} from './pipeline';

// Testing utility types
export type {
  // Error types
  ITestError,
  PipeNextFn,
  // Context types
  PartialTransactionContext,
  MockStateDB,
  MockChainConfig,
  // State types
  MockAccountState,
  MockAssetState,
  MockTokenState,
  MockStakeState,
  MockDelegateState,
  MockTxState,
  // Full context
  TestContext,
  // Pipe function types
  MockPipeFunction,
  MockErrorPipeFunction,
  // Result types
  IExecuteResult,
  IPipeTestResult,
} from './testing';

// Resolver types (shared between @ocap/gql and @ocap/resolver)
export type {
  // Context and args
  IResolverContext,
  IGetAccountStateArgs,
  IGetAccountTokensArgs,
  IAddressArgs,
  // Token and state types
  ITokenInfo,
  IResolverAccountState,
  IResolverStakeState,
  IResolverRollupState,
  IResolverFactoryState,
  // Paging
  IResolverPaging,
  // Transaction types
  IResolverTxItxJson,
  IResolverTransaction,
  // List result types
  IResolverListTransactionsResult,
  IResolverListAssetsResult,
  IResolverListAccountsResult,
  IResolverListTokensResult,
  IResolverListFactoriesResult,
  IResolverListStakesResult,
  IResolverListDelegationsResult,
  IResolverListRollupsResult,
  IResolverListRollupBlocksResult,
  IResolverListRollupValidatorsResult,
  IResolverListTokenFactoriesResult,
  // Info types
  IResolverChainInfo,
  IResolverNodeInfo,
  IResolverNetInfo,
  IResolverValidatorsInfo,
  IResolverForgeStats,
  // Response wrappers
  ITokenFlowsResult,
  ISearchResult,
  IEstimateGasResult,
  IBlocksResult,
  // Main interface
  IResolver,
} from './resolver';

// Ledger types (VLedger - Verifiable Ledger Kernel)
export type {
  // Entry types
  ILedgerEntry,
  ILedgerEntryRow,
  // Checkpoint types
  ICheckpoint,
  ICheckpointRow,
  // Merkle types
  IMerkleProof,
  // Configuration types
  ICheckpointConfig,
  ILedgerCapabilities,
  // Input types
  ISignedTransactionInput,
  // Storage interface
  ILedgerStorage,
  // Main interface
  ILedger,
  // Factory interface
  ILedgerFactory,
  // Table type mappings
  LedgerTableTypeMap,
  LedgerTableName,
} from './ledger';
