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

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

export const protobufPackage = "protobuf";

export interface ComboLeg {
  conId?: number | undefined;
  ratio?: number | undefined;
  action?: string | undefined;
  exchange?: string | undefined;
  openClose?: number | undefined;
  shortSalesSlot?: number | undefined;
  designatedLocation?: string | undefined;
  exemptCode?: number | undefined;
  perLegPrice?: number | undefined;
}

function createBaseComboLeg(): ComboLeg {
  return {
    conId: undefined,
    ratio: undefined,
    action: undefined,
    exchange: undefined,
    openClose: undefined,
    shortSalesSlot: undefined,
    designatedLocation: undefined,
    exemptCode: undefined,
    perLegPrice: undefined,
  };
}

export const ComboLeg: MessageFns<ComboLeg> = {
  encode(message: ComboLeg, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.conId !== undefined) {
      writer.uint32(8).int32(message.conId);
    }
    if (message.ratio !== undefined) {
      writer.uint32(16).int32(message.ratio);
    }
    if (message.action !== undefined) {
      writer.uint32(26).string(message.action);
    }
    if (message.exchange !== undefined) {
      writer.uint32(34).string(message.exchange);
    }
    if (message.openClose !== undefined) {
      writer.uint32(40).int32(message.openClose);
    }
    if (message.shortSalesSlot !== undefined) {
      writer.uint32(48).int32(message.shortSalesSlot);
    }
    if (message.designatedLocation !== undefined) {
      writer.uint32(58).string(message.designatedLocation);
    }
    if (message.exemptCode !== undefined) {
      writer.uint32(64).int32(message.exemptCode);
    }
    if (message.perLegPrice !== undefined) {
      writer.uint32(73).double(message.perLegPrice);
    }
    return writer;
  },

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

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

          message.ratio = reader.int32();
          continue;
        }
        case 3: {
          if (tag !== 26) {
            break;
          }

          message.action = reader.string();
          continue;
        }
        case 4: {
          if (tag !== 34) {
            break;
          }

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

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

          message.shortSalesSlot = reader.int32();
          continue;
        }
        case 7: {
          if (tag !== 58) {
            break;
          }

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

          message.exemptCode = reader.int32();
          continue;
        }
        case 9: {
          if (tag !== 73) {
            break;
          }

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

  fromJSON(object: any): ComboLeg {
    return {
      conId: isSet(object.conId) ? globalThis.Number(object.conId) : undefined,
      ratio: isSet(object.ratio) ? globalThis.Number(object.ratio) : undefined,
      action: isSet(object.action) ? globalThis.String(object.action) : undefined,
      exchange: isSet(object.exchange) ? globalThis.String(object.exchange) : undefined,
      openClose: isSet(object.openClose) ? globalThis.Number(object.openClose) : undefined,
      shortSalesSlot: isSet(object.shortSalesSlot) ? globalThis.Number(object.shortSalesSlot) : undefined,
      designatedLocation: isSet(object.designatedLocation) ? globalThis.String(object.designatedLocation) : undefined,
      exemptCode: isSet(object.exemptCode) ? globalThis.Number(object.exemptCode) : undefined,
      perLegPrice: isSet(object.perLegPrice) ? globalThis.Number(object.perLegPrice) : undefined,
    };
  },

  toJSON(message: ComboLeg): unknown {
    const obj: any = {};
    if (message.conId !== undefined) {
      obj.conId = Math.round(message.conId);
    }
    if (message.ratio !== undefined) {
      obj.ratio = Math.round(message.ratio);
    }
    if (message.action !== undefined) {
      obj.action = message.action;
    }
    if (message.exchange !== undefined) {
      obj.exchange = message.exchange;
    }
    if (message.openClose !== undefined) {
      obj.openClose = Math.round(message.openClose);
    }
    if (message.shortSalesSlot !== undefined) {
      obj.shortSalesSlot = Math.round(message.shortSalesSlot);
    }
    if (message.designatedLocation !== undefined) {
      obj.designatedLocation = message.designatedLocation;
    }
    if (message.exemptCode !== undefined) {
      obj.exemptCode = Math.round(message.exemptCode);
    }
    if (message.perLegPrice !== undefined) {
      obj.perLegPrice = message.perLegPrice;
    }
    return obj;
  },

  create(base?: DeepPartial<ComboLeg>): ComboLeg {
    return ComboLeg.fromPartial(base ?? {});
  },
  fromPartial(object: DeepPartial<ComboLeg>): ComboLeg {
    const message = createBaseComboLeg();
    message.conId = object.conId ?? undefined;
    message.ratio = object.ratio ?? undefined;
    message.action = object.action ?? undefined;
    message.exchange = object.exchange ?? undefined;
    message.openClose = object.openClose ?? undefined;
    message.shortSalesSlot = object.shortSalesSlot ?? undefined;
    message.designatedLocation = object.designatedLocation ?? undefined;
    message.exemptCode = object.exemptCode ?? undefined;
    message.perLegPrice = object.perLegPrice ?? 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;
}
