// This is a generated file - do not edit.
//
// Generated from alt/v1/paper_trading.proto.

// @dart = 3.3

// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names
// ignore_for_file: curly_braces_in_flow_control_structures
// ignore_for_file: deprecated_member_use_from_same_package, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_relative_imports

import 'dart:core' as $core;

import 'package:fixnum/fixnum.dart' as $fixnum;
import 'package:protobuf/protobuf.dart' as $pb;

import 'backtest.pb.dart' as $0;
import 'common.pb.dart' as $2;
import 'market.pb.dart' as $1;

export 'package:protobuf/protobuf.dart' show GeneratedMessageGenericExtensions;

class StartPaperTradingRequest extends $pb.GeneratedMessage {
  factory StartPaperTradingRequest({
    $core.String? accountId,
    $0.BacktestRunSpec? spec,
    $1.Price? startingCash,
  }) {
    final result = create();
    if (accountId != null) result.accountId = accountId;
    if (spec != null) result.spec = spec;
    if (startingCash != null) result.startingCash = startingCash;
    return result;
  }

  StartPaperTradingRequest._();

  factory StartPaperTradingRequest.fromBuffer($core.List<$core.int> data,
          [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>
      create()..mergeFromBuffer(data, registry);
  factory StartPaperTradingRequest.fromJson($core.String json,
          [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>
      create()..mergeFromJson(json, registry);

  static final $pb.BuilderInfo _i = $pb.BuilderInfo(
      _omitMessageNames ? '' : 'StartPaperTradingRequest',
      package: const $pb.PackageName(_omitMessageNames ? '' : 'alt.v1'),
      createEmptyInstance: create)
    ..aOS(1, _omitFieldNames ? '' : 'accountId')
    ..aOM<$0.BacktestRunSpec>(2, _omitFieldNames ? '' : 'spec',
        subBuilder: $0.BacktestRunSpec.create)
    ..aOM<$1.Price>(3, _omitFieldNames ? '' : 'startingCash',
        subBuilder: $1.Price.create)
    ..hasRequiredFields = false;

  @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
  StartPaperTradingRequest clone() => deepCopy();
  @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
  StartPaperTradingRequest copyWith(
          void Function(StartPaperTradingRequest) updates) =>
      super.copyWith((message) => updates(message as StartPaperTradingRequest))
          as StartPaperTradingRequest;

  @$core.override
  $pb.BuilderInfo get info_ => _i;

  @$core.pragma('dart2js:noInline')
  static StartPaperTradingRequest create() => StartPaperTradingRequest._();
  @$core.override
  StartPaperTradingRequest createEmptyInstance() => create();
  @$core.pragma('dart2js:noInline')
  static StartPaperTradingRequest getDefault() => _defaultInstance ??=
      $pb.GeneratedMessage.$_defaultFor<StartPaperTradingRequest>(create);
  static StartPaperTradingRequest? _defaultInstance;

  @$pb.TagNumber(1)
  $core.String get accountId => $_getSZ(0);
  @$pb.TagNumber(1)
  set accountId($core.String value) => $_setString(0, value);
  @$pb.TagNumber(1)
  $core.bool hasAccountId() => $_has(0);
  @$pb.TagNumber(1)
  void clearAccountId() => $_clearField(1);

  @$pb.TagNumber(2)
  $0.BacktestRunSpec get spec => $_getN(1);
  @$pb.TagNumber(2)
  set spec($0.BacktestRunSpec value) => $_setField(2, value);
  @$pb.TagNumber(2)
  $core.bool hasSpec() => $_has(1);
  @$pb.TagNumber(2)
  void clearSpec() => $_clearField(2);
  @$pb.TagNumber(2)
  $0.BacktestRunSpec ensureSpec() => $_ensure(1);

  @$pb.TagNumber(3)
  $1.Price get startingCash => $_getN(2);
  @$pb.TagNumber(3)
  set startingCash($1.Price value) => $_setField(3, value);
  @$pb.TagNumber(3)
  $core.bool hasStartingCash() => $_has(2);
  @$pb.TagNumber(3)
  void clearStartingCash() => $_clearField(3);
  @$pb.TagNumber(3)
  $1.Price ensureStartingCash() => $_ensure(2);
}

class StartPaperTradingResponse extends $pb.GeneratedMessage {
  factory StartPaperTradingResponse({
    PaperTradingState? state,
    $2.ErrorInfo? error,
  }) {
    final result = create();
    if (state != null) result.state = state;
    if (error != null) result.error = error;
    return result;
  }

  StartPaperTradingResponse._();

  factory StartPaperTradingResponse.fromBuffer($core.List<$core.int> data,
          [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>
      create()..mergeFromBuffer(data, registry);
  factory StartPaperTradingResponse.fromJson($core.String json,
          [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>
      create()..mergeFromJson(json, registry);

  static final $pb.BuilderInfo _i = $pb.BuilderInfo(
      _omitMessageNames ? '' : 'StartPaperTradingResponse',
      package: const $pb.PackageName(_omitMessageNames ? '' : 'alt.v1'),
      createEmptyInstance: create)
    ..aOM<PaperTradingState>(1, _omitFieldNames ? '' : 'state',
        subBuilder: PaperTradingState.create)
    ..aOM<$2.ErrorInfo>(2, _omitFieldNames ? '' : 'error',
        subBuilder: $2.ErrorInfo.create)
    ..hasRequiredFields = false;

  @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
  StartPaperTradingResponse clone() => deepCopy();
  @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
  StartPaperTradingResponse copyWith(
          void Function(StartPaperTradingResponse) updates) =>
      super.copyWith((message) => updates(message as StartPaperTradingResponse))
          as StartPaperTradingResponse;

  @$core.override
  $pb.BuilderInfo get info_ => _i;

  @$core.pragma('dart2js:noInline')
  static StartPaperTradingResponse create() => StartPaperTradingResponse._();
  @$core.override
  StartPaperTradingResponse createEmptyInstance() => create();
  @$core.pragma('dart2js:noInline')
  static StartPaperTradingResponse getDefault() => _defaultInstance ??=
      $pb.GeneratedMessage.$_defaultFor<StartPaperTradingResponse>(create);
  static StartPaperTradingResponse? _defaultInstance;

  @$pb.TagNumber(1)
  PaperTradingState get state => $_getN(0);
  @$pb.TagNumber(1)
  set state(PaperTradingState value) => $_setField(1, value);
  @$pb.TagNumber(1)
  $core.bool hasState() => $_has(0);
  @$pb.TagNumber(1)
  void clearState() => $_clearField(1);
  @$pb.TagNumber(1)
  PaperTradingState ensureState() => $_ensure(0);

  @$pb.TagNumber(2)
  $2.ErrorInfo get error => $_getN(1);
  @$pb.TagNumber(2)
  set error($2.ErrorInfo value) => $_setField(2, value);
  @$pb.TagNumber(2)
  $core.bool hasError() => $_has(1);
  @$pb.TagNumber(2)
  void clearError() => $_clearField(2);
  @$pb.TagNumber(2)
  $2.ErrorInfo ensureError() => $_ensure(1);
}

class GetPaperTradingStateRequest extends $pb.GeneratedMessage {
  factory GetPaperTradingStateRequest({
    $core.String? accountId,
  }) {
    final result = create();
    if (accountId != null) result.accountId = accountId;
    return result;
  }

  GetPaperTradingStateRequest._();

  factory GetPaperTradingStateRequest.fromBuffer($core.List<$core.int> data,
          [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>
      create()..mergeFromBuffer(data, registry);
  factory GetPaperTradingStateRequest.fromJson($core.String json,
          [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>
      create()..mergeFromJson(json, registry);

  static final $pb.BuilderInfo _i = $pb.BuilderInfo(
      _omitMessageNames ? '' : 'GetPaperTradingStateRequest',
      package: const $pb.PackageName(_omitMessageNames ? '' : 'alt.v1'),
      createEmptyInstance: create)
    ..aOS(1, _omitFieldNames ? '' : 'accountId')
    ..hasRequiredFields = false;

  @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
  GetPaperTradingStateRequest clone() => deepCopy();
  @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
  GetPaperTradingStateRequest copyWith(
          void Function(GetPaperTradingStateRequest) updates) =>
      super.copyWith(
              (message) => updates(message as GetPaperTradingStateRequest))
          as GetPaperTradingStateRequest;

  @$core.override
  $pb.BuilderInfo get info_ => _i;

  @$core.pragma('dart2js:noInline')
  static GetPaperTradingStateRequest create() =>
      GetPaperTradingStateRequest._();
  @$core.override
  GetPaperTradingStateRequest createEmptyInstance() => create();
  @$core.pragma('dart2js:noInline')
  static GetPaperTradingStateRequest getDefault() => _defaultInstance ??=
      $pb.GeneratedMessage.$_defaultFor<GetPaperTradingStateRequest>(create);
  static GetPaperTradingStateRequest? _defaultInstance;

  @$pb.TagNumber(1)
  $core.String get accountId => $_getSZ(0);
  @$pb.TagNumber(1)
  set accountId($core.String value) => $_setString(0, value);
  @$pb.TagNumber(1)
  $core.bool hasAccountId() => $_has(0);
  @$pb.TagNumber(1)
  void clearAccountId() => $_clearField(1);
}

class GetPaperTradingStateResponse extends $pb.GeneratedMessage {
  factory GetPaperTradingStateResponse({
    PaperTradingState? state,
    $2.ErrorInfo? error,
  }) {
    final result = create();
    if (state != null) result.state = state;
    if (error != null) result.error = error;
    return result;
  }

  GetPaperTradingStateResponse._();

  factory GetPaperTradingStateResponse.fromBuffer($core.List<$core.int> data,
          [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>
      create()..mergeFromBuffer(data, registry);
  factory GetPaperTradingStateResponse.fromJson($core.String json,
          [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>
      create()..mergeFromJson(json, registry);

  static final $pb.BuilderInfo _i = $pb.BuilderInfo(
      _omitMessageNames ? '' : 'GetPaperTradingStateResponse',
      package: const $pb.PackageName(_omitMessageNames ? '' : 'alt.v1'),
      createEmptyInstance: create)
    ..aOM<PaperTradingState>(1, _omitFieldNames ? '' : 'state',
        subBuilder: PaperTradingState.create)
    ..aOM<$2.ErrorInfo>(2, _omitFieldNames ? '' : 'error',
        subBuilder: $2.ErrorInfo.create)
    ..hasRequiredFields = false;

  @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
  GetPaperTradingStateResponse clone() => deepCopy();
  @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
  GetPaperTradingStateResponse copyWith(
          void Function(GetPaperTradingStateResponse) updates) =>
      super.copyWith(
              (message) => updates(message as GetPaperTradingStateResponse))
          as GetPaperTradingStateResponse;

  @$core.override
  $pb.BuilderInfo get info_ => _i;

  @$core.pragma('dart2js:noInline')
  static GetPaperTradingStateResponse create() =>
      GetPaperTradingStateResponse._();
  @$core.override
  GetPaperTradingStateResponse createEmptyInstance() => create();
  @$core.pragma('dart2js:noInline')
  static GetPaperTradingStateResponse getDefault() => _defaultInstance ??=
      $pb.GeneratedMessage.$_defaultFor<GetPaperTradingStateResponse>(create);
  static GetPaperTradingStateResponse? _defaultInstance;

  @$pb.TagNumber(1)
  PaperTradingState get state => $_getN(0);
  @$pb.TagNumber(1)
  set state(PaperTradingState value) => $_setField(1, value);
  @$pb.TagNumber(1)
  $core.bool hasState() => $_has(0);
  @$pb.TagNumber(1)
  void clearState() => $_clearField(1);
  @$pb.TagNumber(1)
  PaperTradingState ensureState() => $_ensure(0);

  @$pb.TagNumber(2)
  $2.ErrorInfo get error => $_getN(1);
  @$pb.TagNumber(2)
  set error($2.ErrorInfo value) => $_setField(2, value);
  @$pb.TagNumber(2)
  $core.bool hasError() => $_has(1);
  @$pb.TagNumber(2)
  void clearError() => $_clearField(2);
  @$pb.TagNumber(2)
  $2.ErrorInfo ensureError() => $_ensure(1);
}

class PaperTradingState extends $pb.GeneratedMessage {
  factory PaperTradingState({
    $core.String? accountId,
    $0.BacktestRun? run,
    $1.Price? cash,
    $core.Iterable<$0.BacktestPosition>? positions,
    $core.Iterable<$0.BacktestTrade>? fills,
    $core.Iterable<$0.BacktestEquityPoint>? equityCurve,
    $core.Iterable<PaperRiskRejection>? riskRejections,
  }) {
    final result = create();
    if (accountId != null) result.accountId = accountId;
    if (run != null) result.run = run;
    if (cash != null) result.cash = cash;
    if (positions != null) result.positions.addAll(positions);
    if (fills != null) result.fills.addAll(fills);
    if (equityCurve != null) result.equityCurve.addAll(equityCurve);
    if (riskRejections != null) result.riskRejections.addAll(riskRejections);
    return result;
  }

  PaperTradingState._();

  factory PaperTradingState.fromBuffer($core.List<$core.int> data,
          [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>
      create()..mergeFromBuffer(data, registry);
  factory PaperTradingState.fromJson($core.String json,
          [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>
      create()..mergeFromJson(json, registry);

  static final $pb.BuilderInfo _i = $pb.BuilderInfo(
      _omitMessageNames ? '' : 'PaperTradingState',
      package: const $pb.PackageName(_omitMessageNames ? '' : 'alt.v1'),
      createEmptyInstance: create)
    ..aOS(1, _omitFieldNames ? '' : 'accountId')
    ..aOM<$0.BacktestRun>(2, _omitFieldNames ? '' : 'run',
        subBuilder: $0.BacktestRun.create)
    ..aOM<$1.Price>(3, _omitFieldNames ? '' : 'cash',
        subBuilder: $1.Price.create)
    ..pPM<$0.BacktestPosition>(4, _omitFieldNames ? '' : 'positions',
        subBuilder: $0.BacktestPosition.create)
    ..pPM<$0.BacktestTrade>(5, _omitFieldNames ? '' : 'fills',
        subBuilder: $0.BacktestTrade.create)
    ..pPM<$0.BacktestEquityPoint>(6, _omitFieldNames ? '' : 'equityCurve',
        subBuilder: $0.BacktestEquityPoint.create)
    ..pPM<PaperRiskRejection>(7, _omitFieldNames ? '' : 'riskRejections',
        subBuilder: PaperRiskRejection.create)
    ..hasRequiredFields = false;

  @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
  PaperTradingState clone() => deepCopy();
  @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
  PaperTradingState copyWith(void Function(PaperTradingState) updates) =>
      super.copyWith((message) => updates(message as PaperTradingState))
          as PaperTradingState;

  @$core.override
  $pb.BuilderInfo get info_ => _i;

  @$core.pragma('dart2js:noInline')
  static PaperTradingState create() => PaperTradingState._();
  @$core.override
  PaperTradingState createEmptyInstance() => create();
  @$core.pragma('dart2js:noInline')
  static PaperTradingState getDefault() => _defaultInstance ??=
      $pb.GeneratedMessage.$_defaultFor<PaperTradingState>(create);
  static PaperTradingState? _defaultInstance;

  @$pb.TagNumber(1)
  $core.String get accountId => $_getSZ(0);
  @$pb.TagNumber(1)
  set accountId($core.String value) => $_setString(0, value);
  @$pb.TagNumber(1)
  $core.bool hasAccountId() => $_has(0);
  @$pb.TagNumber(1)
  void clearAccountId() => $_clearField(1);

  @$pb.TagNumber(2)
  $0.BacktestRun get run => $_getN(1);
  @$pb.TagNumber(2)
  set run($0.BacktestRun value) => $_setField(2, value);
  @$pb.TagNumber(2)
  $core.bool hasRun() => $_has(1);
  @$pb.TagNumber(2)
  void clearRun() => $_clearField(2);
  @$pb.TagNumber(2)
  $0.BacktestRun ensureRun() => $_ensure(1);

  @$pb.TagNumber(3)
  $1.Price get cash => $_getN(2);
  @$pb.TagNumber(3)
  set cash($1.Price value) => $_setField(3, value);
  @$pb.TagNumber(3)
  $core.bool hasCash() => $_has(2);
  @$pb.TagNumber(3)
  void clearCash() => $_clearField(3);
  @$pb.TagNumber(3)
  $1.Price ensureCash() => $_ensure(2);

  @$pb.TagNumber(4)
  $pb.PbList<$0.BacktestPosition> get positions => $_getList(3);

  @$pb.TagNumber(5)
  $pb.PbList<$0.BacktestTrade> get fills => $_getList(4);

  @$pb.TagNumber(6)
  $pb.PbList<$0.BacktestEquityPoint> get equityCurve => $_getList(5);

  /// risk_rejections lists orders the paper run's risk gate or portfolio refused.
  /// It is additive: an empty list means every decided order cleared risk, while a
  /// non-empty list lets the operator surface a blocked risk summary without faking
  /// broker behaviour. The fill path stays unchanged; this only exposes rejections
  /// the engine already tracked internally.
  @$pb.TagNumber(7)
  $pb.PbList<PaperRiskRejection> get riskRejections => $_getList(6);
}

/// PaperRiskRejection summarises a single order that the paper run did not fill
/// because a risk decision or portfolio application denied it. It mirrors the
/// worker-owned RejectedOrder so operator surfaces can distinguish clear vs
/// blocked risk without inspecting raw engine state.
class PaperRiskRejection extends $pb.GeneratedMessage {
  factory PaperRiskRejection({
    $core.String? instrumentId,
    $core.String? side,
    $1.Quantity? quantity,
    $core.String? reason,
    $fixnum.Int64? timestampUnixMs,
  }) {
    final result = create();
    if (instrumentId != null) result.instrumentId = instrumentId;
    if (side != null) result.side = side;
    if (quantity != null) result.quantity = quantity;
    if (reason != null) result.reason = reason;
    if (timestampUnixMs != null) result.timestampUnixMs = timestampUnixMs;
    return result;
  }

  PaperRiskRejection._();

  factory PaperRiskRejection.fromBuffer($core.List<$core.int> data,
          [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>
      create()..mergeFromBuffer(data, registry);
  factory PaperRiskRejection.fromJson($core.String json,
          [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>
      create()..mergeFromJson(json, registry);

  static final $pb.BuilderInfo _i = $pb.BuilderInfo(
      _omitMessageNames ? '' : 'PaperRiskRejection',
      package: const $pb.PackageName(_omitMessageNames ? '' : 'alt.v1'),
      createEmptyInstance: create)
    ..aOS(1, _omitFieldNames ? '' : 'instrumentId')
    ..aOS(2, _omitFieldNames ? '' : 'side')
    ..aOM<$1.Quantity>(3, _omitFieldNames ? '' : 'quantity',
        subBuilder: $1.Quantity.create)
    ..aOS(4, _omitFieldNames ? '' : 'reason')
    ..aInt64(5, _omitFieldNames ? '' : 'timestampUnixMs')
    ..hasRequiredFields = false;

  @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
  PaperRiskRejection clone() => deepCopy();
  @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
  PaperRiskRejection copyWith(void Function(PaperRiskRejection) updates) =>
      super.copyWith((message) => updates(message as PaperRiskRejection))
          as PaperRiskRejection;

  @$core.override
  $pb.BuilderInfo get info_ => _i;

  @$core.pragma('dart2js:noInline')
  static PaperRiskRejection create() => PaperRiskRejection._();
  @$core.override
  PaperRiskRejection createEmptyInstance() => create();
  @$core.pragma('dart2js:noInline')
  static PaperRiskRejection getDefault() => _defaultInstance ??=
      $pb.GeneratedMessage.$_defaultFor<PaperRiskRejection>(create);
  static PaperRiskRejection? _defaultInstance;

  @$pb.TagNumber(1)
  $core.String get instrumentId => $_getSZ(0);
  @$pb.TagNumber(1)
  set instrumentId($core.String value) => $_setString(0, value);
  @$pb.TagNumber(1)
  $core.bool hasInstrumentId() => $_has(0);
  @$pb.TagNumber(1)
  void clearInstrumentId() => $_clearField(1);

  @$pb.TagNumber(2)
  $core.String get side => $_getSZ(1);
  @$pb.TagNumber(2)
  set side($core.String value) => $_setString(1, value);
  @$pb.TagNumber(2)
  $core.bool hasSide() => $_has(1);
  @$pb.TagNumber(2)
  void clearSide() => $_clearField(2);

  @$pb.TagNumber(3)
  $1.Quantity get quantity => $_getN(2);
  @$pb.TagNumber(3)
  set quantity($1.Quantity value) => $_setField(3, value);
  @$pb.TagNumber(3)
  $core.bool hasQuantity() => $_has(2);
  @$pb.TagNumber(3)
  void clearQuantity() => $_clearField(3);
  @$pb.TagNumber(3)
  $1.Quantity ensureQuantity() => $_ensure(2);

  @$pb.TagNumber(4)
  $core.String get reason => $_getSZ(3);
  @$pb.TagNumber(4)
  set reason($core.String value) => $_setString(3, value);
  @$pb.TagNumber(4)
  $core.bool hasReason() => $_has(3);
  @$pb.TagNumber(4)
  void clearReason() => $_clearField(4);

  @$pb.TagNumber(5)
  $fixnum.Int64 get timestampUnixMs => $_getI64(4);
  @$pb.TagNumber(5)
  set timestampUnixMs($fixnum.Int64 value) => $_setInt64(4, value);
  @$pb.TagNumber(5)
  $core.bool hasTimestampUnixMs() => $_has(4);
  @$pb.TagNumber(5)
  void clearTimestampUnixMs() => $_clearField(5);
}

/// PaperOrder is an operator-submitted virtual order tracked against a started
/// paper account. Side/type/status stay string-typed to match the existing paper
/// summary shapes (PaperRiskRejection.side) and to keep the lifecycle additive
/// without introducing new enums. No real broker order is ever created.
class PaperOrder extends $pb.GeneratedMessage {
  factory PaperOrder({
    $core.String? orderId,
    $core.String? accountId,
    $core.String? instrumentId,
    $core.String? side,
    $1.Quantity? quantity,
    $core.String? type,
    $1.Price? limitPrice,
    $core.String? status,
    $core.String? reason,
    $0.BacktestTrade? fill,
    $fixnum.Int64? createdAtUnixMs,
    $fixnum.Int64? updatedAtUnixMs,
  }) {
    final result = create();
    if (orderId != null) result.orderId = orderId;
    if (accountId != null) result.accountId = accountId;
    if (instrumentId != null) result.instrumentId = instrumentId;
    if (side != null) result.side = side;
    if (quantity != null) result.quantity = quantity;
    if (type != null) result.type = type;
    if (limitPrice != null) result.limitPrice = limitPrice;
    if (status != null) result.status = status;
    if (reason != null) result.reason = reason;
    if (fill != null) result.fill = fill;
    if (createdAtUnixMs != null) result.createdAtUnixMs = createdAtUnixMs;
    if (updatedAtUnixMs != null) result.updatedAtUnixMs = updatedAtUnixMs;
    return result;
  }

  PaperOrder._();

  factory PaperOrder.fromBuffer($core.List<$core.int> data,
          [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>
      create()..mergeFromBuffer(data, registry);
  factory PaperOrder.fromJson($core.String json,
          [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>
      create()..mergeFromJson(json, registry);

  static final $pb.BuilderInfo _i = $pb.BuilderInfo(
      _omitMessageNames ? '' : 'PaperOrder',
      package: const $pb.PackageName(_omitMessageNames ? '' : 'alt.v1'),
      createEmptyInstance: create)
    ..aOS(1, _omitFieldNames ? '' : 'orderId')
    ..aOS(2, _omitFieldNames ? '' : 'accountId')
    ..aOS(3, _omitFieldNames ? '' : 'instrumentId')
    ..aOS(4, _omitFieldNames ? '' : 'side')
    ..aOM<$1.Quantity>(5, _omitFieldNames ? '' : 'quantity',
        subBuilder: $1.Quantity.create)
    ..aOS(6, _omitFieldNames ? '' : 'type')
    ..aOM<$1.Price>(7, _omitFieldNames ? '' : 'limitPrice',
        subBuilder: $1.Price.create)
    ..aOS(8, _omitFieldNames ? '' : 'status')
    ..aOS(9, _omitFieldNames ? '' : 'reason')
    ..aOM<$0.BacktestTrade>(10, _omitFieldNames ? '' : 'fill',
        subBuilder: $0.BacktestTrade.create)
    ..aInt64(11, _omitFieldNames ? '' : 'createdAtUnixMs')
    ..aInt64(12, _omitFieldNames ? '' : 'updatedAtUnixMs')
    ..hasRequiredFields = false;

  @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
  PaperOrder clone() => deepCopy();
  @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
  PaperOrder copyWith(void Function(PaperOrder) updates) =>
      super.copyWith((message) => updates(message as PaperOrder)) as PaperOrder;

  @$core.override
  $pb.BuilderInfo get info_ => _i;

  @$core.pragma('dart2js:noInline')
  static PaperOrder create() => PaperOrder._();
  @$core.override
  PaperOrder createEmptyInstance() => create();
  @$core.pragma('dart2js:noInline')
  static PaperOrder getDefault() => _defaultInstance ??=
      $pb.GeneratedMessage.$_defaultFor<PaperOrder>(create);
  static PaperOrder? _defaultInstance;

  @$pb.TagNumber(1)
  $core.String get orderId => $_getSZ(0);
  @$pb.TagNumber(1)
  set orderId($core.String value) => $_setString(0, value);
  @$pb.TagNumber(1)
  $core.bool hasOrderId() => $_has(0);
  @$pb.TagNumber(1)
  void clearOrderId() => $_clearField(1);

  @$pb.TagNumber(2)
  $core.String get accountId => $_getSZ(1);
  @$pb.TagNumber(2)
  set accountId($core.String value) => $_setString(1, value);
  @$pb.TagNumber(2)
  $core.bool hasAccountId() => $_has(1);
  @$pb.TagNumber(2)
  void clearAccountId() => $_clearField(2);

  @$pb.TagNumber(3)
  $core.String get instrumentId => $_getSZ(2);
  @$pb.TagNumber(3)
  set instrumentId($core.String value) => $_setString(2, value);
  @$pb.TagNumber(3)
  $core.bool hasInstrumentId() => $_has(2);
  @$pb.TagNumber(3)
  void clearInstrumentId() => $_clearField(3);

  /// side is "buy" or "sell".
  @$pb.TagNumber(4)
  $core.String get side => $_getSZ(3);
  @$pb.TagNumber(4)
  set side($core.String value) => $_setString(3, value);
  @$pb.TagNumber(4)
  $core.bool hasSide() => $_has(3);
  @$pb.TagNumber(4)
  void clearSide() => $_clearField(4);

  @$pb.TagNumber(5)
  $1.Quantity get quantity => $_getN(4);
  @$pb.TagNumber(5)
  set quantity($1.Quantity value) => $_setField(5, value);
  @$pb.TagNumber(5)
  $core.bool hasQuantity() => $_has(4);
  @$pb.TagNumber(5)
  void clearQuantity() => $_clearField(5);
  @$pb.TagNumber(5)
  $1.Quantity ensureQuantity() => $_ensure(4);

  /// type is "market" or "limit".
  @$pb.TagNumber(6)
  $core.String get type => $_getSZ(5);
  @$pb.TagNumber(6)
  set type($core.String value) => $_setString(5, value);
  @$pb.TagNumber(6)
  $core.bool hasType() => $_has(5);
  @$pb.TagNumber(6)
  void clearType() => $_clearField(6);

  /// limit_price is only set for a limit order.
  @$pb.TagNumber(7)
  $1.Price get limitPrice => $_getN(6);
  @$pb.TagNumber(7)
  set limitPrice($1.Price value) => $_setField(7, value);
  @$pb.TagNumber(7)
  $core.bool hasLimitPrice() => $_has(6);
  @$pb.TagNumber(7)
  void clearLimitPrice() => $_clearField(7);
  @$pb.TagNumber(7)
  $1.Price ensureLimitPrice() => $_ensure(6);

  /// status is "pending", "filled", "canceled", or "rejected".
  @$pb.TagNumber(8)
  $core.String get status => $_getSZ(7);
  @$pb.TagNumber(8)
  set status($core.String value) => $_setString(7, value);
  @$pb.TagNumber(8)
  $core.bool hasStatus() => $_has(7);
  @$pb.TagNumber(8)
  void clearStatus() => $_clearField(8);

  /// reason is populated when status is "rejected" (risk or portfolio denial).
  @$pb.TagNumber(9)
  $core.String get reason => $_getSZ(8);
  @$pb.TagNumber(9)
  set reason($core.String value) => $_setString(8, value);
  @$pb.TagNumber(9)
  $core.bool hasReason() => $_has(8);
  @$pb.TagNumber(9)
  void clearReason() => $_clearField(9);

  /// fill is populated when status is "filled"; it reuses the BacktestTrade shape
  /// so a fill summary carries instrument/side/quantity/price/timestamp.
  @$pb.TagNumber(10)
  $0.BacktestTrade get fill => $_getN(9);
  @$pb.TagNumber(10)
  set fill($0.BacktestTrade value) => $_setField(10, value);
  @$pb.TagNumber(10)
  $core.bool hasFill() => $_has(9);
  @$pb.TagNumber(10)
  void clearFill() => $_clearField(10);
  @$pb.TagNumber(10)
  $0.BacktestTrade ensureFill() => $_ensure(9);

  @$pb.TagNumber(11)
  $fixnum.Int64 get createdAtUnixMs => $_getI64(10);
  @$pb.TagNumber(11)
  set createdAtUnixMs($fixnum.Int64 value) => $_setInt64(10, value);
  @$pb.TagNumber(11)
  $core.bool hasCreatedAtUnixMs() => $_has(10);
  @$pb.TagNumber(11)
  void clearCreatedAtUnixMs() => $_clearField(11);

  @$pb.TagNumber(12)
  $fixnum.Int64 get updatedAtUnixMs => $_getI64(11);
  @$pb.TagNumber(12)
  set updatedAtUnixMs($fixnum.Int64 value) => $_setInt64(11, value);
  @$pb.TagNumber(12)
  $core.bool hasUpdatedAtUnixMs() => $_has(11);
  @$pb.TagNumber(12)
  void clearUpdatedAtUnixMs() => $_clearField(12);
}

class SubmitPaperOrderRequest extends $pb.GeneratedMessage {
  factory SubmitPaperOrderRequest({
    $core.String? accountId,
    $core.String? instrumentId,
    $core.String? side,
    $1.Quantity? quantity,
    $core.String? type,
    $1.Price? limitPrice,
  }) {
    final result = create();
    if (accountId != null) result.accountId = accountId;
    if (instrumentId != null) result.instrumentId = instrumentId;
    if (side != null) result.side = side;
    if (quantity != null) result.quantity = quantity;
    if (type != null) result.type = type;
    if (limitPrice != null) result.limitPrice = limitPrice;
    return result;
  }

  SubmitPaperOrderRequest._();

  factory SubmitPaperOrderRequest.fromBuffer($core.List<$core.int> data,
          [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>
      create()..mergeFromBuffer(data, registry);
  factory SubmitPaperOrderRequest.fromJson($core.String json,
          [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>
      create()..mergeFromJson(json, registry);

  static final $pb.BuilderInfo _i = $pb.BuilderInfo(
      _omitMessageNames ? '' : 'SubmitPaperOrderRequest',
      package: const $pb.PackageName(_omitMessageNames ? '' : 'alt.v1'),
      createEmptyInstance: create)
    ..aOS(1, _omitFieldNames ? '' : 'accountId')
    ..aOS(2, _omitFieldNames ? '' : 'instrumentId')
    ..aOS(3, _omitFieldNames ? '' : 'side')
    ..aOM<$1.Quantity>(4, _omitFieldNames ? '' : 'quantity',
        subBuilder: $1.Quantity.create)
    ..aOS(5, _omitFieldNames ? '' : 'type')
    ..aOM<$1.Price>(6, _omitFieldNames ? '' : 'limitPrice',
        subBuilder: $1.Price.create)
    ..hasRequiredFields = false;

  @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
  SubmitPaperOrderRequest clone() => deepCopy();
  @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
  SubmitPaperOrderRequest copyWith(
          void Function(SubmitPaperOrderRequest) updates) =>
      super.copyWith((message) => updates(message as SubmitPaperOrderRequest))
          as SubmitPaperOrderRequest;

  @$core.override
  $pb.BuilderInfo get info_ => _i;

  @$core.pragma('dart2js:noInline')
  static SubmitPaperOrderRequest create() => SubmitPaperOrderRequest._();
  @$core.override
  SubmitPaperOrderRequest createEmptyInstance() => create();
  @$core.pragma('dart2js:noInline')
  static SubmitPaperOrderRequest getDefault() => _defaultInstance ??=
      $pb.GeneratedMessage.$_defaultFor<SubmitPaperOrderRequest>(create);
  static SubmitPaperOrderRequest? _defaultInstance;

  @$pb.TagNumber(1)
  $core.String get accountId => $_getSZ(0);
  @$pb.TagNumber(1)
  set accountId($core.String value) => $_setString(0, value);
  @$pb.TagNumber(1)
  $core.bool hasAccountId() => $_has(0);
  @$pb.TagNumber(1)
  void clearAccountId() => $_clearField(1);

  @$pb.TagNumber(2)
  $core.String get instrumentId => $_getSZ(1);
  @$pb.TagNumber(2)
  set instrumentId($core.String value) => $_setString(1, value);
  @$pb.TagNumber(2)
  $core.bool hasInstrumentId() => $_has(1);
  @$pb.TagNumber(2)
  void clearInstrumentId() => $_clearField(2);

  @$pb.TagNumber(3)
  $core.String get side => $_getSZ(2);
  @$pb.TagNumber(3)
  set side($core.String value) => $_setString(2, value);
  @$pb.TagNumber(3)
  $core.bool hasSide() => $_has(2);
  @$pb.TagNumber(3)
  void clearSide() => $_clearField(3);

  @$pb.TagNumber(4)
  $1.Quantity get quantity => $_getN(3);
  @$pb.TagNumber(4)
  set quantity($1.Quantity value) => $_setField(4, value);
  @$pb.TagNumber(4)
  $core.bool hasQuantity() => $_has(3);
  @$pb.TagNumber(4)
  void clearQuantity() => $_clearField(4);
  @$pb.TagNumber(4)
  $1.Quantity ensureQuantity() => $_ensure(3);

  @$pb.TagNumber(5)
  $core.String get type => $_getSZ(4);
  @$pb.TagNumber(5)
  set type($core.String value) => $_setString(4, value);
  @$pb.TagNumber(5)
  $core.bool hasType() => $_has(4);
  @$pb.TagNumber(5)
  void clearType() => $_clearField(5);

  @$pb.TagNumber(6)
  $1.Price get limitPrice => $_getN(5);
  @$pb.TagNumber(6)
  set limitPrice($1.Price value) => $_setField(6, value);
  @$pb.TagNumber(6)
  $core.bool hasLimitPrice() => $_has(5);
  @$pb.TagNumber(6)
  void clearLimitPrice() => $_clearField(6);
  @$pb.TagNumber(6)
  $1.Price ensureLimitPrice() => $_ensure(5);
}

class SubmitPaperOrderResponse extends $pb.GeneratedMessage {
  factory SubmitPaperOrderResponse({
    PaperOrder? order,
    $2.ErrorInfo? error,
  }) {
    final result = create();
    if (order != null) result.order = order;
    if (error != null) result.error = error;
    return result;
  }

  SubmitPaperOrderResponse._();

  factory SubmitPaperOrderResponse.fromBuffer($core.List<$core.int> data,
          [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>
      create()..mergeFromBuffer(data, registry);
  factory SubmitPaperOrderResponse.fromJson($core.String json,
          [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>
      create()..mergeFromJson(json, registry);

  static final $pb.BuilderInfo _i = $pb.BuilderInfo(
      _omitMessageNames ? '' : 'SubmitPaperOrderResponse',
      package: const $pb.PackageName(_omitMessageNames ? '' : 'alt.v1'),
      createEmptyInstance: create)
    ..aOM<PaperOrder>(1, _omitFieldNames ? '' : 'order',
        subBuilder: PaperOrder.create)
    ..aOM<$2.ErrorInfo>(2, _omitFieldNames ? '' : 'error',
        subBuilder: $2.ErrorInfo.create)
    ..hasRequiredFields = false;

  @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
  SubmitPaperOrderResponse clone() => deepCopy();
  @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
  SubmitPaperOrderResponse copyWith(
          void Function(SubmitPaperOrderResponse) updates) =>
      super.copyWith((message) => updates(message as SubmitPaperOrderResponse))
          as SubmitPaperOrderResponse;

  @$core.override
  $pb.BuilderInfo get info_ => _i;

  @$core.pragma('dart2js:noInline')
  static SubmitPaperOrderResponse create() => SubmitPaperOrderResponse._();
  @$core.override
  SubmitPaperOrderResponse createEmptyInstance() => create();
  @$core.pragma('dart2js:noInline')
  static SubmitPaperOrderResponse getDefault() => _defaultInstance ??=
      $pb.GeneratedMessage.$_defaultFor<SubmitPaperOrderResponse>(create);
  static SubmitPaperOrderResponse? _defaultInstance;

  @$pb.TagNumber(1)
  PaperOrder get order => $_getN(0);
  @$pb.TagNumber(1)
  set order(PaperOrder value) => $_setField(1, value);
  @$pb.TagNumber(1)
  $core.bool hasOrder() => $_has(0);
  @$pb.TagNumber(1)
  void clearOrder() => $_clearField(1);
  @$pb.TagNumber(1)
  PaperOrder ensureOrder() => $_ensure(0);

  @$pb.TagNumber(2)
  $2.ErrorInfo get error => $_getN(1);
  @$pb.TagNumber(2)
  set error($2.ErrorInfo value) => $_setField(2, value);
  @$pb.TagNumber(2)
  $core.bool hasError() => $_has(1);
  @$pb.TagNumber(2)
  void clearError() => $_clearField(2);
  @$pb.TagNumber(2)
  $2.ErrorInfo ensureError() => $_ensure(1);
}

class CancelPaperOrderRequest extends $pb.GeneratedMessage {
  factory CancelPaperOrderRequest({
    $core.String? accountId,
    $core.String? orderId,
  }) {
    final result = create();
    if (accountId != null) result.accountId = accountId;
    if (orderId != null) result.orderId = orderId;
    return result;
  }

  CancelPaperOrderRequest._();

  factory CancelPaperOrderRequest.fromBuffer($core.List<$core.int> data,
          [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>
      create()..mergeFromBuffer(data, registry);
  factory CancelPaperOrderRequest.fromJson($core.String json,
          [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>
      create()..mergeFromJson(json, registry);

  static final $pb.BuilderInfo _i = $pb.BuilderInfo(
      _omitMessageNames ? '' : 'CancelPaperOrderRequest',
      package: const $pb.PackageName(_omitMessageNames ? '' : 'alt.v1'),
      createEmptyInstance: create)
    ..aOS(1, _omitFieldNames ? '' : 'accountId')
    ..aOS(2, _omitFieldNames ? '' : 'orderId')
    ..hasRequiredFields = false;

  @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
  CancelPaperOrderRequest clone() => deepCopy();
  @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
  CancelPaperOrderRequest copyWith(
          void Function(CancelPaperOrderRequest) updates) =>
      super.copyWith((message) => updates(message as CancelPaperOrderRequest))
          as CancelPaperOrderRequest;

  @$core.override
  $pb.BuilderInfo get info_ => _i;

  @$core.pragma('dart2js:noInline')
  static CancelPaperOrderRequest create() => CancelPaperOrderRequest._();
  @$core.override
  CancelPaperOrderRequest createEmptyInstance() => create();
  @$core.pragma('dart2js:noInline')
  static CancelPaperOrderRequest getDefault() => _defaultInstance ??=
      $pb.GeneratedMessage.$_defaultFor<CancelPaperOrderRequest>(create);
  static CancelPaperOrderRequest? _defaultInstance;

  @$pb.TagNumber(1)
  $core.String get accountId => $_getSZ(0);
  @$pb.TagNumber(1)
  set accountId($core.String value) => $_setString(0, value);
  @$pb.TagNumber(1)
  $core.bool hasAccountId() => $_has(0);
  @$pb.TagNumber(1)
  void clearAccountId() => $_clearField(1);

  @$pb.TagNumber(2)
  $core.String get orderId => $_getSZ(1);
  @$pb.TagNumber(2)
  set orderId($core.String value) => $_setString(1, value);
  @$pb.TagNumber(2)
  $core.bool hasOrderId() => $_has(1);
  @$pb.TagNumber(2)
  void clearOrderId() => $_clearField(2);
}

class CancelPaperOrderResponse extends $pb.GeneratedMessage {
  factory CancelPaperOrderResponse({
    PaperOrder? order,
    $2.ErrorInfo? error,
  }) {
    final result = create();
    if (order != null) result.order = order;
    if (error != null) result.error = error;
    return result;
  }

  CancelPaperOrderResponse._();

  factory CancelPaperOrderResponse.fromBuffer($core.List<$core.int> data,
          [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>
      create()..mergeFromBuffer(data, registry);
  factory CancelPaperOrderResponse.fromJson($core.String json,
          [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>
      create()..mergeFromJson(json, registry);

  static final $pb.BuilderInfo _i = $pb.BuilderInfo(
      _omitMessageNames ? '' : 'CancelPaperOrderResponse',
      package: const $pb.PackageName(_omitMessageNames ? '' : 'alt.v1'),
      createEmptyInstance: create)
    ..aOM<PaperOrder>(1, _omitFieldNames ? '' : 'order',
        subBuilder: PaperOrder.create)
    ..aOM<$2.ErrorInfo>(2, _omitFieldNames ? '' : 'error',
        subBuilder: $2.ErrorInfo.create)
    ..hasRequiredFields = false;

  @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
  CancelPaperOrderResponse clone() => deepCopy();
  @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
  CancelPaperOrderResponse copyWith(
          void Function(CancelPaperOrderResponse) updates) =>
      super.copyWith((message) => updates(message as CancelPaperOrderResponse))
          as CancelPaperOrderResponse;

  @$core.override
  $pb.BuilderInfo get info_ => _i;

  @$core.pragma('dart2js:noInline')
  static CancelPaperOrderResponse create() => CancelPaperOrderResponse._();
  @$core.override
  CancelPaperOrderResponse createEmptyInstance() => create();
  @$core.pragma('dart2js:noInline')
  static CancelPaperOrderResponse getDefault() => _defaultInstance ??=
      $pb.GeneratedMessage.$_defaultFor<CancelPaperOrderResponse>(create);
  static CancelPaperOrderResponse? _defaultInstance;

  @$pb.TagNumber(1)
  PaperOrder get order => $_getN(0);
  @$pb.TagNumber(1)
  set order(PaperOrder value) => $_setField(1, value);
  @$pb.TagNumber(1)
  $core.bool hasOrder() => $_has(0);
  @$pb.TagNumber(1)
  void clearOrder() => $_clearField(1);
  @$pb.TagNumber(1)
  PaperOrder ensureOrder() => $_ensure(0);

  @$pb.TagNumber(2)
  $2.ErrorInfo get error => $_getN(1);
  @$pb.TagNumber(2)
  set error($2.ErrorInfo value) => $_setField(2, value);
  @$pb.TagNumber(2)
  $core.bool hasError() => $_has(1);
  @$pb.TagNumber(2)
  void clearError() => $_clearField(2);
  @$pb.TagNumber(2)
  $2.ErrorInfo ensureError() => $_ensure(1);
}

class FillPaperOrderRequest extends $pb.GeneratedMessage {
  factory FillPaperOrderRequest({
    $core.String? accountId,
    $core.String? orderId,
    $1.Price? fillPrice,
  }) {
    final result = create();
    if (accountId != null) result.accountId = accountId;
    if (orderId != null) result.orderId = orderId;
    if (fillPrice != null) result.fillPrice = fillPrice;
    return result;
  }

  FillPaperOrderRequest._();

  factory FillPaperOrderRequest.fromBuffer($core.List<$core.int> data,
          [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>
      create()..mergeFromBuffer(data, registry);
  factory FillPaperOrderRequest.fromJson($core.String json,
          [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>
      create()..mergeFromJson(json, registry);

  static final $pb.BuilderInfo _i = $pb.BuilderInfo(
      _omitMessageNames ? '' : 'FillPaperOrderRequest',
      package: const $pb.PackageName(_omitMessageNames ? '' : 'alt.v1'),
      createEmptyInstance: create)
    ..aOS(1, _omitFieldNames ? '' : 'accountId')
    ..aOS(2, _omitFieldNames ? '' : 'orderId')
    ..aOM<$1.Price>(3, _omitFieldNames ? '' : 'fillPrice',
        subBuilder: $1.Price.create)
    ..hasRequiredFields = false;

  @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
  FillPaperOrderRequest clone() => deepCopy();
  @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
  FillPaperOrderRequest copyWith(
          void Function(FillPaperOrderRequest) updates) =>
      super.copyWith((message) => updates(message as FillPaperOrderRequest))
          as FillPaperOrderRequest;

  @$core.override
  $pb.BuilderInfo get info_ => _i;

  @$core.pragma('dart2js:noInline')
  static FillPaperOrderRequest create() => FillPaperOrderRequest._();
  @$core.override
  FillPaperOrderRequest createEmptyInstance() => create();
  @$core.pragma('dart2js:noInline')
  static FillPaperOrderRequest getDefault() => _defaultInstance ??=
      $pb.GeneratedMessage.$_defaultFor<FillPaperOrderRequest>(create);
  static FillPaperOrderRequest? _defaultInstance;

  @$pb.TagNumber(1)
  $core.String get accountId => $_getSZ(0);
  @$pb.TagNumber(1)
  set accountId($core.String value) => $_setString(0, value);
  @$pb.TagNumber(1)
  $core.bool hasAccountId() => $_has(0);
  @$pb.TagNumber(1)
  void clearAccountId() => $_clearField(1);

  @$pb.TagNumber(2)
  $core.String get orderId => $_getSZ(1);
  @$pb.TagNumber(2)
  set orderId($core.String value) => $_setString(1, value);
  @$pb.TagNumber(2)
  $core.bool hasOrderId() => $_has(1);
  @$pb.TagNumber(2)
  void clearOrderId() => $_clearField(2);

  /// fill_price is the simulated execution price for a market order. A limit order
  /// executes at its own limit price, so fill_price may be omitted for it.
  @$pb.TagNumber(3)
  $1.Price get fillPrice => $_getN(2);
  @$pb.TagNumber(3)
  set fillPrice($1.Price value) => $_setField(3, value);
  @$pb.TagNumber(3)
  $core.bool hasFillPrice() => $_has(2);
  @$pb.TagNumber(3)
  void clearFillPrice() => $_clearField(3);
  @$pb.TagNumber(3)
  $1.Price ensureFillPrice() => $_ensure(2);
}

class FillPaperOrderResponse extends $pb.GeneratedMessage {
  factory FillPaperOrderResponse({
    PaperOrder? order,
    PaperTradingState? state,
    $2.ErrorInfo? error,
  }) {
    final result = create();
    if (order != null) result.order = order;
    if (state != null) result.state = state;
    if (error != null) result.error = error;
    return result;
  }

  FillPaperOrderResponse._();

  factory FillPaperOrderResponse.fromBuffer($core.List<$core.int> data,
          [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>
      create()..mergeFromBuffer(data, registry);
  factory FillPaperOrderResponse.fromJson($core.String json,
          [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) =>
      create()..mergeFromJson(json, registry);

  static final $pb.BuilderInfo _i = $pb.BuilderInfo(
      _omitMessageNames ? '' : 'FillPaperOrderResponse',
      package: const $pb.PackageName(_omitMessageNames ? '' : 'alt.v1'),
      createEmptyInstance: create)
    ..aOM<PaperOrder>(1, _omitFieldNames ? '' : 'order',
        subBuilder: PaperOrder.create)
    ..aOM<PaperTradingState>(2, _omitFieldNames ? '' : 'state',
        subBuilder: PaperTradingState.create)
    ..aOM<$2.ErrorInfo>(3, _omitFieldNames ? '' : 'error',
        subBuilder: $2.ErrorInfo.create)
    ..hasRequiredFields = false;

  @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
  FillPaperOrderResponse clone() => deepCopy();
  @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.')
  FillPaperOrderResponse copyWith(
          void Function(FillPaperOrderResponse) updates) =>
      super.copyWith((message) => updates(message as FillPaperOrderResponse))
          as FillPaperOrderResponse;

  @$core.override
  $pb.BuilderInfo get info_ => _i;

  @$core.pragma('dart2js:noInline')
  static FillPaperOrderResponse create() => FillPaperOrderResponse._();
  @$core.override
  FillPaperOrderResponse createEmptyInstance() => create();
  @$core.pragma('dart2js:noInline')
  static FillPaperOrderResponse getDefault() => _defaultInstance ??=
      $pb.GeneratedMessage.$_defaultFor<FillPaperOrderResponse>(create);
  static FillPaperOrderResponse? _defaultInstance;

  @$pb.TagNumber(1)
  PaperOrder get order => $_getN(0);
  @$pb.TagNumber(1)
  set order(PaperOrder value) => $_setField(1, value);
  @$pb.TagNumber(1)
  $core.bool hasOrder() => $_has(0);
  @$pb.TagNumber(1)
  void clearOrder() => $_clearField(1);
  @$pb.TagNumber(1)
  PaperOrder ensureOrder() => $_ensure(0);

  /// state is the account snapshot after the fill so the operator sees the cash
  /// and position effect without a second query. For a rejected order it carries
  /// the unchanged account state.
  @$pb.TagNumber(2)
  PaperTradingState get state => $_getN(1);
  @$pb.TagNumber(2)
  set state(PaperTradingState value) => $_setField(2, value);
  @$pb.TagNumber(2)
  $core.bool hasState() => $_has(1);
  @$pb.TagNumber(2)
  void clearState() => $_clearField(2);
  @$pb.TagNumber(2)
  PaperTradingState ensureState() => $_ensure(1);

  @$pb.TagNumber(3)
  $2.ErrorInfo get error => $_getN(2);
  @$pb.TagNumber(3)
  set error($2.ErrorInfo value) => $_setField(3, value);
  @$pb.TagNumber(3)
  $core.bool hasError() => $_has(2);
  @$pb.TagNumber(3)
  void clearError() => $_clearField(3);
  @$pb.TagNumber(3)
  $2.ErrorInfo ensureError() => $_ensure(2);
}

const $core.bool _omitFieldNames =
    $core.bool.fromEnvironment('protobuf.omit_field_names');
const $core.bool _omitMessageNames =
    $core.bool.fromEnvironment('protobuf.omit_message_names');
