// Broker Gateway Service - FIX Order Routing Protocol
//
// This service handles all broker communication via FIX 4.2/4.4 protocol
// for order routing, execution management, and account state synchronization.

// @generated by protoc-gen-es v2.11.0 with parameter "target=js+dts"
// @generated from file broker_gateway.proto (package broker_gateway, syntax proto3)
/* eslint-disable */

import type { GenEnum, GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2";
import type { Message } from "@bufbuild/protobuf";

/**
 * Describes the file broker_gateway.proto.
 */
export declare const file_broker_gateway: GenFile;

/**
 * @generated from message broker_gateway.RouteOrderRequest
 */
export declare type RouteOrderRequest = Message<"broker_gateway.RouteOrderRequest"> & {
  /**
   * ES, NQ, etc.
   *
   * @generated from field: string symbol = 1;
   */
  symbol: string;

  /**
   * BUY, SELL
   *
   * @generated from field: broker_gateway.OrderSide side = 2;
   */
  side: OrderSide;

  /**
   * Number of contracts
   *
   * @generated from field: double quantity = 3;
   */
  quantity: number;

  /**
   * MARKET, LIMIT, STOP, STOP_LIMIT
   *
   * @generated from field: broker_gateway.OrderType order_type = 4;
   */
  orderType: OrderType;

  /**
   * Limit price (required for LIMIT orders)
   *
   * @generated from field: optional double price = 5;
   */
  price?: number;

  /**
   * Stop price (required for STOP orders)
   *
   * @generated from field: optional double stop_price = 6;
   */
  stopPrice?: number;

  /**
   * AMP account identifier
   *
   * @generated from field: string account_id = 7;
   */
  accountId: string;

  /**
   * Strategy, model_name, etc.
   *
   * @generated from field: map<string, string> metadata = 8;
   */
  metadata: { [key: string]: string };
};

/**
 * Describes the message broker_gateway.RouteOrderRequest.
 * Use `create(RouteOrderRequestSchema)` to create a new message.
 */
export declare const RouteOrderRequestSchema: GenMessage<RouteOrderRequest>;

/**
 * @generated from message broker_gateway.RouteOrderResponse
 */
export declare type RouteOrderResponse = Message<"broker_gateway.RouteOrderResponse"> & {
  /**
   * Broker-assigned OrderID (Tag 37, filled after ack)
   *
   * @generated from field: string broker_order_id = 1;
   */
  brokerOrderId: string;

  /**
   * Our ClOrdID (Tag 11)
   *
   * @generated from field: string client_order_id = 2;
   */
  clientOrderId: string;

  /**
   * PENDING_SUBMIT, SUBMITTED, etc.
   *
   * @generated from field: broker_gateway.OrderStatus status = 3;
   */
  status: OrderStatus;

  /**
   * Timestamp (nanoseconds)
   *
   * @generated from field: int64 submitted_at = 4;
   */
  submittedAt: bigint;

  /**
   * Success/error message
   *
   * @generated from field: string message = 5;
   */
  message: string;
};

/**
 * Describes the message broker_gateway.RouteOrderResponse.
 * Use `create(RouteOrderResponseSchema)` to create a new message.
 */
export declare const RouteOrderResponseSchema: GenMessage<RouteOrderResponse>;

/**
 * @generated from message broker_gateway.CancelOrderRequest
 */
export declare type CancelOrderRequest = Message<"broker_gateway.CancelOrderRequest"> & {
  /**
   * Order to cancel
   *
   * @generated from field: string client_order_id = 1;
   */
  clientOrderId: string;

  /**
   * Account verification
   *
   * @generated from field: string account_id = 2;
   */
  accountId: string;
};

/**
 * Describes the message broker_gateway.CancelOrderRequest.
 * Use `create(CancelOrderRequestSchema)` to create a new message.
 */
export declare const CancelOrderRequestSchema: GenMessage<CancelOrderRequest>;

/**
 * @generated from message broker_gateway.CancelOrderResponse
 */
export declare type CancelOrderResponse = Message<"broker_gateway.CancelOrderResponse"> & {
  /**
   * @generated from field: bool success = 1;
   */
  success: boolean;

  /**
   * @generated from field: string message = 2;
   */
  message: string;

  /**
   * CANCEL_PENDING, CANCELLED, etc.
   *
   * @generated from field: broker_gateway.OrderStatus new_status = 3;
   */
  newStatus: OrderStatus;
};

/**
 * Describes the message broker_gateway.CancelOrderResponse.
 * Use `create(CancelOrderResponseSchema)` to create a new message.
 */
export declare const CancelOrderResponseSchema: GenMessage<CancelOrderResponse>;

/**
 * @generated from message broker_gateway.GetAccountStateRequest
 */
export declare type GetAccountStateRequest = Message<"broker_gateway.GetAccountStateRequest"> & {
  /**
   * @generated from field: string account_id = 1;
   */
  accountId: string;
};

/**
 * Describes the message broker_gateway.GetAccountStateRequest.
 * Use `create(GetAccountStateRequestSchema)` to create a new message.
 */
export declare const GetAccountStateRequestSchema: GenMessage<GetAccountStateRequest>;

/**
 * @generated from message broker_gateway.GetAccountStateResponse
 */
export declare type GetAccountStateResponse = Message<"broker_gateway.GetAccountStateResponse"> & {
  /**
   * @generated from field: string account_id = 1;
   */
  accountId: string;

  /**
   * @generated from field: double cash_balance = 2;
   */
  cashBalance: number;

  /**
   * @generated from field: double equity = 3;
   */
  equity: number;

  /**
   * @generated from field: double margin_used = 4;
   */
  marginUsed: number;

  /**
   * @generated from field: double margin_available = 5;
   */
  marginAvailable: number;

  /**
   * @generated from field: double buying_power = 6;
   */
  buyingPower: number;

  /**
   * @generated from field: double unrealized_pnl = 7;
   */
  unrealizedPnl: number;

  /**
   * @generated from field: double realized_pnl = 8;
   */
  realizedPnl: number;

  /**
   * Timestamp (nanoseconds)
   *
   * @generated from field: int64 last_updated = 9;
   */
  lastUpdated: bigint;
};

/**
 * Describes the message broker_gateway.GetAccountStateResponse.
 * Use `create(GetAccountStateResponseSchema)` to create a new message.
 */
export declare const GetAccountStateResponseSchema: GenMessage<GetAccountStateResponse>;

/**
 * @generated from message broker_gateway.GetPositionsRequest
 */
export declare type GetPositionsRequest = Message<"broker_gateway.GetPositionsRequest"> & {
  /**
   * @generated from field: string account_id = 1;
   */
  accountId: string;

  /**
   * Filter by symbol (optional)
   *
   * @generated from field: optional string symbol = 2;
   */
  symbol?: string;
};

/**
 * Describes the message broker_gateway.GetPositionsRequest.
 * Use `create(GetPositionsRequestSchema)` to create a new message.
 */
export declare const GetPositionsRequestSchema: GenMessage<GetPositionsRequest>;

/**
 * @generated from message broker_gateway.GetPositionsResponse
 */
export declare type GetPositionsResponse = Message<"broker_gateway.GetPositionsResponse"> & {
  /**
   * @generated from field: repeated broker_gateway.Position positions = 1;
   */
  positions: Position[];

  /**
   * @generated from field: double total_equity = 2;
   */
  totalEquity: number;

  /**
   * @generated from field: double total_exposure = 3;
   */
  totalExposure: number;

  /**
   * @generated from field: double leverage_ratio = 4;
   */
  leverageRatio: number;

  /**
   * @generated from field: int64 timestamp = 5;
   */
  timestamp: bigint;
};

/**
 * Describes the message broker_gateway.GetPositionsResponse.
 * Use `create(GetPositionsResponseSchema)` to create a new message.
 */
export declare const GetPositionsResponseSchema: GenMessage<GetPositionsResponse>;

/**
 * @generated from message broker_gateway.Position
 */
export declare type Position = Message<"broker_gateway.Position"> & {
  /**
   * @generated from field: string symbol = 1;
   */
  symbol: string;

  /**
   * Positive = long, negative = short
   *
   * @generated from field: double quantity = 2;
   */
  quantity: number;

  /**
   * @generated from field: double average_price = 3;
   */
  averagePrice: number;

  /**
   * @generated from field: double market_value = 4;
   */
  marketValue: number;

  /**
   * @generated from field: double unrealized_pnl = 5;
   */
  unrealizedPnl: number;
};

/**
 * Describes the message broker_gateway.Position.
 * Use `create(PositionSchema)` to create a new message.
 */
export declare const PositionSchema: GenMessage<Position>;

/**
 * @generated from message broker_gateway.GetSessionStatusRequest
 */
export declare type GetSessionStatusRequest = Message<"broker_gateway.GetSessionStatusRequest"> & {
  /**
   * Optional: default to active session
   *
   * @generated from field: optional string session_id = 1;
   */
  sessionId?: string;
};

/**
 * Describes the message broker_gateway.GetSessionStatusRequest.
 * Use `create(GetSessionStatusRequestSchema)` to create a new message.
 */
export declare const GetSessionStatusRequestSchema: GenMessage<GetSessionStatusRequest>;

/**
 * @generated from message broker_gateway.GetSessionStatusResponse
 */
export declare type GetSessionStatusResponse = Message<"broker_gateway.GetSessionStatusResponse"> & {
  /**
   * @generated from field: string session_id = 1;
   */
  sessionId: string;

  /**
   * @generated from field: broker_gateway.SessionState state = 2;
   */
  state: SessionState;

  /**
   * Current outgoing sequence
   *
   * @generated from field: int64 sender_seq_num = 3;
   */
  senderSeqNum: bigint;

  /**
   * Expected incoming sequence
   *
   * @generated from field: int64 target_seq_num = 4;
   */
  targetSeqNum: bigint;

  /**
   * Timestamp (nanoseconds)
   *
   * @generated from field: int64 last_heartbeat_sent = 5;
   */
  lastHeartbeatSent: bigint;

  /**
   * Timestamp (nanoseconds)
   *
   * @generated from field: int64 last_heartbeat_received = 6;
   */
  lastHeartbeatReceived: bigint;

  /**
   * Round-trip time in milliseconds
   *
   * @generated from field: double heartbeat_rtt_ms = 7;
   */
  heartbeatRttMs: number;

  /**
   * Timestamp (nanoseconds)
   *
   * @generated from field: int64 connected_at = 8;
   */
  connectedAt: bigint;

  /**
   * Additional session info
   *
   * @generated from field: map<string, string> details = 9;
   */
  details: { [key: string]: string };
};

/**
 * Describes the message broker_gateway.GetSessionStatusResponse.
 * Use `create(GetSessionStatusResponseSchema)` to create a new message.
 */
export declare const GetSessionStatusResponseSchema: GenMessage<GetSessionStatusResponse>;

/**
 * @generated from message broker_gateway.StreamExecutionsRequest
 */
export declare type StreamExecutionsRequest = Message<"broker_gateway.StreamExecutionsRequest"> & {
  /**
   * Filter by account
   *
   * @generated from field: optional string account_id = 1;
   */
  accountId?: string;

  /**
   * Filter by symbol
   *
   * @generated from field: optional string symbol = 2;
   */
  symbol?: string;
};

/**
 * Describes the message broker_gateway.StreamExecutionsRequest.
 * Use `create(StreamExecutionsRequestSchema)` to create a new message.
 */
export declare const StreamExecutionsRequestSchema: GenMessage<StreamExecutionsRequest>;

/**
 * @generated from message broker_gateway.ExecutionEvent
 */
export declare type ExecutionEvent = Message<"broker_gateway.ExecutionEvent"> & {
  /**
   * ExecID (Tag 17)
   *
   * @generated from field: string execution_id = 1;
   */
  executionId: string;

  /**
   * OrderID (Tag 37)
   *
   * @generated from field: string broker_order_id = 2;
   */
  brokerOrderId: string;

  /**
   * ClOrdID (Tag 11)
   *
   * @generated from field: string client_order_id = 3;
   */
  clientOrderId: string;

  /**
   * @generated from field: string symbol = 4;
   */
  symbol: string;

  /**
   * @generated from field: broker_gateway.OrderSide side = 5;
   */
  side: OrderSide;

  /**
   * NEW, TRADE, CANCELED, REJECTED
   *
   * @generated from field: broker_gateway.ExecutionType exec_type = 6;
   */
  execType: ExecutionType;

  /**
   * Order status after this execution
   *
   * @generated from field: broker_gateway.OrderStatus order_status = 7;
   */
  orderStatus: OrderStatus;

  /**
   * Quantity filled (Tag 32)
   *
   * @generated from field: double last_qty = 8;
   */
  lastQty: number;

  /**
   * Fill price (Tag 31)
   *
   * @generated from field: double last_price = 9;
   */
  lastPrice: number;

  /**
   * Total filled (Tag 14)
   *
   * @generated from field: double cum_qty = 10;
   */
  cumQty: number;

  /**
   * Average fill price (Tag 6)
   *
   * @generated from field: double avg_price = 11;
   */
  avgPrice: number;

  /**
   * Execution timestamp
   *
   * @generated from field: int64 transact_time = 12;
   */
  transactTime: bigint;

  /**
   * Reject reason (if applicable)
   *
   * @generated from field: optional string text = 13;
   */
  text?: string;
};

/**
 * Describes the message broker_gateway.ExecutionEvent.
 * Use `create(ExecutionEventSchema)` to create a new message.
 */
export declare const ExecutionEventSchema: GenMessage<ExecutionEvent>;

/**
 * @generated from message broker_gateway.HealthCheckRequest
 */
export declare type HealthCheckRequest = Message<"broker_gateway.HealthCheckRequest"> & {
};

/**
 * Describes the message broker_gateway.HealthCheckRequest.
 * Use `create(HealthCheckRequestSchema)` to create a new message.
 */
export declare const HealthCheckRequestSchema: GenMessage<HealthCheckRequest>;

/**
 * @generated from message broker_gateway.HealthCheckResponse
 */
export declare type HealthCheckResponse = Message<"broker_gateway.HealthCheckResponse"> & {
  /**
   * @generated from field: bool healthy = 1;
   */
  healthy: boolean;

  /**
   * @generated from field: string message = 2;
   */
  message: string;

  /**
   * @generated from field: map<string, string> details = 3;
   */
  details: { [key: string]: string };
};

/**
 * Describes the message broker_gateway.HealthCheckResponse.
 * Use `create(HealthCheckResponseSchema)` to create a new message.
 */
export declare const HealthCheckResponseSchema: GenMessage<HealthCheckResponse>;

/**
 * @generated from message broker_gateway.StreamAccountStateRequest
 */
export declare type StreamAccountStateRequest = Message<"broker_gateway.StreamAccountStateRequest"> & {
  /**
   * 0 = server default (3s)
   *
   * @generated from field: uint32 interval_seconds = 1;
   */
  intervalSeconds: number;
};

/**
 * Describes the message broker_gateway.StreamAccountStateRequest.
 * Use `create(StreamAccountStateRequestSchema)` to create a new message.
 */
export declare const StreamAccountStateRequestSchema: GenMessage<StreamAccountStateRequest>;

/**
 * @generated from message broker_gateway.StreamSessionStatusRequest
 */
export declare type StreamSessionStatusRequest = Message<"broker_gateway.StreamSessionStatusRequest"> & {
  /**
   * 0 = server default (5s)
   *
   * @generated from field: uint32 interval_seconds = 1;
   */
  intervalSeconds: number;
};

/**
 * Describes the message broker_gateway.StreamSessionStatusRequest.
 * Use `create(StreamSessionStatusRequestSchema)` to create a new message.
 */
export declare const StreamSessionStatusRequestSchema: GenMessage<StreamSessionStatusRequest>;

/**
 * @generated from enum broker_gateway.OrderSide
 */
export enum OrderSide {
  /**
   * @generated from enum value: ORDER_SIDE_UNSPECIFIED = 0;
   */
  UNSPECIFIED = 0,

  /**
   * @generated from enum value: ORDER_SIDE_BUY = 1;
   */
  BUY = 1,

  /**
   * @generated from enum value: ORDER_SIDE_SELL = 2;
   */
  SELL = 2,
}

/**
 * Describes the enum broker_gateway.OrderSide.
 */
export declare const OrderSideSchema: GenEnum<OrderSide>;

/**
 * @generated from enum broker_gateway.OrderType
 */
export enum OrderType {
  /**
   * @generated from enum value: ORDER_TYPE_UNSPECIFIED = 0;
   */
  UNSPECIFIED = 0,

  /**
   * @generated from enum value: ORDER_TYPE_MARKET = 1;
   */
  MARKET = 1,

  /**
   * @generated from enum value: ORDER_TYPE_LIMIT = 2;
   */
  LIMIT = 2,

  /**
   * @generated from enum value: ORDER_TYPE_STOP = 3;
   */
  STOP = 3,

  /**
   * @generated from enum value: ORDER_TYPE_STOP_LIMIT = 4;
   */
  STOP_LIMIT = 4,
}

/**
 * Describes the enum broker_gateway.OrderType.
 */
export declare const OrderTypeSchema: GenEnum<OrderType>;

/**
 * @generated from enum broker_gateway.OrderStatus
 */
export enum OrderStatus {
  /**
   * @generated from enum value: ORDER_STATUS_UNSPECIFIED = 0;
   */
  UNSPECIFIED = 0,

  /**
   * @generated from enum value: ORDER_STATUS_PENDING_SUBMIT = 1;
   */
  PENDING_SUBMIT = 1,

  /**
   * @generated from enum value: ORDER_STATUS_SUBMITTED = 2;
   */
  SUBMITTED = 2,

  /**
   * @generated from enum value: ORDER_STATUS_PARTIALLY_FILLED = 3;
   */
  PARTIALLY_FILLED = 3,

  /**
   * @generated from enum value: ORDER_STATUS_FILLED = 4;
   */
  FILLED = 4,

  /**
   * @generated from enum value: ORDER_STATUS_CANCEL_PENDING = 5;
   */
  CANCEL_PENDING = 5,

  /**
   * @generated from enum value: ORDER_STATUS_CANCELLED = 6;
   */
  CANCELLED = 6,

  /**
   * @generated from enum value: ORDER_STATUS_REJECTED = 7;
   */
  REJECTED = 7,
}

/**
 * Describes the enum broker_gateway.OrderStatus.
 */
export declare const OrderStatusSchema: GenEnum<OrderStatus>;

/**
 * @generated from enum broker_gateway.ExecutionType
 */
export enum ExecutionType {
  /**
   * @generated from enum value: EXECUTION_TYPE_UNSPECIFIED = 0;
   */
  UNSPECIFIED = 0,

  /**
   * Order accepted
   *
   * @generated from enum value: EXECUTION_TYPE_NEW = 1;
   */
  NEW = 1,

  /**
   * Partial or full fill
   *
   * @generated from enum value: EXECUTION_TYPE_TRADE = 2;
   */
  TRADE = 2,

  /**
   * Order canceled
   *
   * @generated from enum value: EXECUTION_TYPE_CANCELED = 3;
   */
  CANCELED = 3,

  /**
   * Order rejected
   *
   * @generated from enum value: EXECUTION_TYPE_REJECTED = 4;
   */
  REJECTED = 4,
}

/**
 * Describes the enum broker_gateway.ExecutionType.
 */
export declare const ExecutionTypeSchema: GenEnum<ExecutionType>;

/**
 * @generated from enum broker_gateway.SessionState
 */
export enum SessionState {
  /**
   * @generated from enum value: SESSION_STATE_DISCONNECTED = 0;
   */
  DISCONNECTED = 0,

  /**
   * @generated from enum value: SESSION_STATE_CONNECTED = 1;
   */
  CONNECTED = 1,

  /**
   * @generated from enum value: SESSION_STATE_LOGGING_IN = 2;
   */
  LOGGING_IN = 2,

  /**
   * @generated from enum value: SESSION_STATE_ACTIVE = 3;
   */
  ACTIVE = 3,

  /**
   * @generated from enum value: SESSION_STATE_LOGGING_OUT = 4;
   */
  LOGGING_OUT = 4,
}

/**
 * Describes the enum broker_gateway.SessionState.
 */
export declare const SessionStateSchema: GenEnum<SessionState>;

/**
 * @generated from service broker_gateway.BrokerGatewayService
 */
export declare const BrokerGatewayService: GenService<{
  /**
   * Route order to broker via FIX protocol
   *
   * @generated from rpc broker_gateway.BrokerGatewayService.RouteOrder
   */
  routeOrder: {
    methodKind: "unary";
    input: typeof RouteOrderRequestSchema;
    output: typeof RouteOrderResponseSchema;
  },
  /**
   * Cancel existing order
   *
   * @generated from rpc broker_gateway.BrokerGatewayService.CancelOrder
   */
  cancelOrder: {
    methodKind: "unary";
    input: typeof CancelOrderRequestSchema;
    output: typeof CancelOrderResponseSchema;
  },
  /**
   * Get current account state (balance, margin, positions)
   *
   * @generated from rpc broker_gateway.BrokerGatewayService.GetAccountState
   */
  getAccountState: {
    methodKind: "unary";
    input: typeof GetAccountStateRequestSchema;
    output: typeof GetAccountStateResponseSchema;
  },
  /**
   * Get all positions for account
   *
   * @generated from rpc broker_gateway.BrokerGatewayService.GetPositions
   */
  getPositions: {
    methodKind: "unary";
    input: typeof GetPositionsRequestSchema;
    output: typeof GetPositionsResponseSchema;
  },
  /**
   * Get FIX session status
   *
   * @generated from rpc broker_gateway.BrokerGatewayService.GetSessionStatus
   */
  getSessionStatus: {
    methodKind: "unary";
    input: typeof GetSessionStatusRequestSchema;
    output: typeof GetSessionStatusResponseSchema;
  },
  /**
   * Stream real-time executions from broker
   *
   * @generated from rpc broker_gateway.BrokerGatewayService.StreamExecutions
   */
  streamExecutions: {
    methodKind: "server_streaming";
    input: typeof StreamExecutionsRequestSchema;
    output: typeof ExecutionEventSchema;
  },
  /**
   * Health check
   *
   * @generated from rpc broker_gateway.BrokerGatewayService.HealthCheck
   */
  healthCheck: {
    methodKind: "unary";
    input: typeof HealthCheckRequestSchema;
    output: typeof HealthCheckResponseSchema;
  },
  /**
   * Server-streaming: polls GetAccountState at gateway level
   *
   * @generated from rpc broker_gateway.BrokerGatewayService.StreamAccountState
   */
  streamAccountState: {
    methodKind: "server_streaming";
    input: typeof StreamAccountStateRequestSchema;
    output: typeof GetAccountStateResponseSchema;
  },
  /**
   * Server-streaming: polls GetSessionStatus at gateway level
   *
   * @generated from rpc broker_gateway.BrokerGatewayService.StreamSessionStatus
   */
  streamSessionStatus: {
    methodKind: "server_streaming";
    input: typeof StreamSessionStatusRequestSchema;
    output: typeof GetSessionStatusResponseSchema;
  },
}>;

