// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
//   protoc-gen-ts_proto  v2.11.5
//   protoc               v7.34.1
// source: ApiPrecautionsConfig.proto

/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";

export const protobufPackage = "protobuf";

export interface ApiPrecautionsConfig {
  bypassOrderPrecautions?: boolean | undefined;
  bypassBondWarning?: boolean | undefined;
  bypassNegativeYieldConfirmation?: boolean | undefined;
  bypassCalledBondWarning?: boolean | undefined;
  bypassSameActionPairTradeWarning?: boolean | undefined;
  bypassFlaggedAccountsWarning?: boolean | undefined;
  bypassPriceBasedVolatilityWarning?: boolean | undefined;
  bypassRedirectOrderWarning?: boolean | undefined;
  bypassNoOverfillProtection?: boolean | undefined;
  bypassRouteMarketableToBBO?: boolean | undefined;
}

function createBaseApiPrecautionsConfig(): ApiPrecautionsConfig {
  return {
    bypassOrderPrecautions: undefined,
    bypassBondWarning: undefined,
    bypassNegativeYieldConfirmation: undefined,
    bypassCalledBondWarning: undefined,
    bypassSameActionPairTradeWarning: undefined,
    bypassFlaggedAccountsWarning: undefined,
    bypassPriceBasedVolatilityWarning: undefined,
    bypassRedirectOrderWarning: undefined,
    bypassNoOverfillProtection: undefined,
    bypassRouteMarketableToBBO: undefined,
  };
}

export const ApiPrecautionsConfig: MessageFns<ApiPrecautionsConfig> = {
  encode(message: ApiPrecautionsConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.bypassOrderPrecautions !== undefined) {
      writer.uint32(8).bool(message.bypassOrderPrecautions);
    }
    if (message.bypassBondWarning !== undefined) {
      writer.uint32(16).bool(message.bypassBondWarning);
    }
    if (message.bypassNegativeYieldConfirmation !== undefined) {
      writer.uint32(24).bool(message.bypassNegativeYieldConfirmation);
    }
    if (message.bypassCalledBondWarning !== undefined) {
      writer.uint32(32).bool(message.bypassCalledBondWarning);
    }
    if (message.bypassSameActionPairTradeWarning !== undefined) {
      writer.uint32(40).bool(message.bypassSameActionPairTradeWarning);
    }
    if (message.bypassFlaggedAccountsWarning !== undefined) {
      writer.uint32(48).bool(message.bypassFlaggedAccountsWarning);
    }
    if (message.bypassPriceBasedVolatilityWarning !== undefined) {
      writer.uint32(56).bool(message.bypassPriceBasedVolatilityWarning);
    }
    if (message.bypassRedirectOrderWarning !== undefined) {
      writer.uint32(64).bool(message.bypassRedirectOrderWarning);
    }
    if (message.bypassNoOverfillProtection !== undefined) {
      writer.uint32(72).bool(message.bypassNoOverfillProtection);
    }
    if (message.bypassRouteMarketableToBBO !== undefined) {
      writer.uint32(80).bool(message.bypassRouteMarketableToBBO);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): ApiPrecautionsConfig {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseApiPrecautionsConfig();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 8) {
            break;
          }

          message.bypassOrderPrecautions = reader.bool();
          continue;
        }
        case 2: {
          if (tag !== 16) {
            break;
          }

          message.bypassBondWarning = reader.bool();
          continue;
        }
        case 3: {
          if (tag !== 24) {
            break;
          }

          message.bypassNegativeYieldConfirmation = reader.bool();
          continue;
        }
        case 4: {
          if (tag !== 32) {
            break;
          }

          message.bypassCalledBondWarning = reader.bool();
          continue;
        }
        case 5: {
          if (tag !== 40) {
            break;
          }

          message.bypassSameActionPairTradeWarning = reader.bool();
          continue;
        }
        case 6: {
          if (tag !== 48) {
            break;
          }

          message.bypassFlaggedAccountsWarning = reader.bool();
          continue;
        }
        case 7: {
          if (tag !== 56) {
            break;
          }

          message.bypassPriceBasedVolatilityWarning = reader.bool();
          continue;
        }
        case 8: {
          if (tag !== 64) {
            break;
          }

          message.bypassRedirectOrderWarning = reader.bool();
          continue;
        }
        case 9: {
          if (tag !== 72) {
            break;
          }

          message.bypassNoOverfillProtection = reader.bool();
          continue;
        }
        case 10: {
          if (tag !== 80) {
            break;
          }

          message.bypassRouteMarketableToBBO = reader.bool();
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): ApiPrecautionsConfig {
    return {
      bypassOrderPrecautions: isSet(object.bypassOrderPrecautions)
        ? globalThis.Boolean(object.bypassOrderPrecautions)
        : undefined,
      bypassBondWarning: isSet(object.bypassBondWarning) ? globalThis.Boolean(object.bypassBondWarning) : undefined,
      bypassNegativeYieldConfirmation: isSet(object.bypassNegativeYieldConfirmation)
        ? globalThis.Boolean(object.bypassNegativeYieldConfirmation)
        : undefined,
      bypassCalledBondWarning: isSet(object.bypassCalledBondWarning)
        ? globalThis.Boolean(object.bypassCalledBondWarning)
        : undefined,
      bypassSameActionPairTradeWarning: isSet(object.bypassSameActionPairTradeWarning)
        ? globalThis.Boolean(object.bypassSameActionPairTradeWarning)
        : undefined,
      bypassFlaggedAccountsWarning: isSet(object.bypassFlaggedAccountsWarning)
        ? globalThis.Boolean(object.bypassFlaggedAccountsWarning)
        : undefined,
      bypassPriceBasedVolatilityWarning: isSet(object.bypassPriceBasedVolatilityWarning)
        ? globalThis.Boolean(object.bypassPriceBasedVolatilityWarning)
        : undefined,
      bypassRedirectOrderWarning: isSet(object.bypassRedirectOrderWarning)
        ? globalThis.Boolean(object.bypassRedirectOrderWarning)
        : undefined,
      bypassNoOverfillProtection: isSet(object.bypassNoOverfillProtection)
        ? globalThis.Boolean(object.bypassNoOverfillProtection)
        : undefined,
      bypassRouteMarketableToBBO: isSet(object.bypassRouteMarketableToBBO)
        ? globalThis.Boolean(object.bypassRouteMarketableToBBO)
        : undefined,
    };
  },

  toJSON(message: ApiPrecautionsConfig): unknown {
    const obj: any = {};
    if (message.bypassOrderPrecautions !== undefined) {
      obj.bypassOrderPrecautions = message.bypassOrderPrecautions;
    }
    if (message.bypassBondWarning !== undefined) {
      obj.bypassBondWarning = message.bypassBondWarning;
    }
    if (message.bypassNegativeYieldConfirmation !== undefined) {
      obj.bypassNegativeYieldConfirmation = message.bypassNegativeYieldConfirmation;
    }
    if (message.bypassCalledBondWarning !== undefined) {
      obj.bypassCalledBondWarning = message.bypassCalledBondWarning;
    }
    if (message.bypassSameActionPairTradeWarning !== undefined) {
      obj.bypassSameActionPairTradeWarning = message.bypassSameActionPairTradeWarning;
    }
    if (message.bypassFlaggedAccountsWarning !== undefined) {
      obj.bypassFlaggedAccountsWarning = message.bypassFlaggedAccountsWarning;
    }
    if (message.bypassPriceBasedVolatilityWarning !== undefined) {
      obj.bypassPriceBasedVolatilityWarning = message.bypassPriceBasedVolatilityWarning;
    }
    if (message.bypassRedirectOrderWarning !== undefined) {
      obj.bypassRedirectOrderWarning = message.bypassRedirectOrderWarning;
    }
    if (message.bypassNoOverfillProtection !== undefined) {
      obj.bypassNoOverfillProtection = message.bypassNoOverfillProtection;
    }
    if (message.bypassRouteMarketableToBBO !== undefined) {
      obj.bypassRouteMarketableToBBO = message.bypassRouteMarketableToBBO;
    }
    return obj;
  },

  create(base?: DeepPartial<ApiPrecautionsConfig>): ApiPrecautionsConfig {
    return ApiPrecautionsConfig.fromPartial(base ?? {});
  },
  fromPartial(object: DeepPartial<ApiPrecautionsConfig>): ApiPrecautionsConfig {
    const message = createBaseApiPrecautionsConfig();
    message.bypassOrderPrecautions = object.bypassOrderPrecautions ?? undefined;
    message.bypassBondWarning = object.bypassBondWarning ?? undefined;
    message.bypassNegativeYieldConfirmation = object.bypassNegativeYieldConfirmation ?? undefined;
    message.bypassCalledBondWarning = object.bypassCalledBondWarning ?? undefined;
    message.bypassSameActionPairTradeWarning = object.bypassSameActionPairTradeWarning ?? undefined;
    message.bypassFlaggedAccountsWarning = object.bypassFlaggedAccountsWarning ?? undefined;
    message.bypassPriceBasedVolatilityWarning = object.bypassPriceBasedVolatilityWarning ?? undefined;
    message.bypassRedirectOrderWarning = object.bypassRedirectOrderWarning ?? undefined;
    message.bypassNoOverfillProtection = object.bypassNoOverfillProtection ?? undefined;
    message.bypassRouteMarketableToBBO = object.bypassRouteMarketableToBBO ?? undefined;
    return message;
  },
};

type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;

export type DeepPartial<T> = T extends Builtin ? T
  : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
  : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
  : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
  : Partial<T>;

function isSet(value: any): boolean {
  return value !== null && value !== undefined;
}

export interface MessageFns<T> {
  encode(message: T, writer?: BinaryWriter): BinaryWriter;
  decode(input: BinaryReader | Uint8Array, length?: number): T;
  fromJSON(object: any): T;
  toJSON(message: T): unknown;
  create(base?: DeepPartial<T>): T;
  fromPartial(object: DeepPartial<T>): T;
}
