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

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

export const protobufPackage = "protobuf";

export interface MarketDepthData {
  position?: number | undefined;
  operation?: number | undefined;
  side?: number | undefined;
  price?: number | undefined;
  size?: string | undefined;
  marketMaker?: string | undefined;
  isSmartDepth?: boolean | undefined;
}

function createBaseMarketDepthData(): MarketDepthData {
  return {
    position: undefined,
    operation: undefined,
    side: undefined,
    price: undefined,
    size: undefined,
    marketMaker: undefined,
    isSmartDepth: undefined,
  };
}

export const MarketDepthData: MessageFns<MarketDepthData> = {
  encode(message: MarketDepthData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.position !== undefined) {
      writer.uint32(8).int32(message.position);
    }
    if (message.operation !== undefined) {
      writer.uint32(16).int32(message.operation);
    }
    if (message.side !== undefined) {
      writer.uint32(24).int32(message.side);
    }
    if (message.price !== undefined) {
      writer.uint32(33).double(message.price);
    }
    if (message.size !== undefined) {
      writer.uint32(42).string(message.size);
    }
    if (message.marketMaker !== undefined) {
      writer.uint32(50).string(message.marketMaker);
    }
    if (message.isSmartDepth !== undefined) {
      writer.uint32(56).bool(message.isSmartDepth);
    }
    return writer;
  },

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

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

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

          message.side = reader.int32();
          continue;
        }
        case 4: {
          if (tag !== 33) {
            break;
          }

          message.price = reader.double();
          continue;
        }
        case 5: {
          if (tag !== 42) {
            break;
          }

          message.size = reader.string();
          continue;
        }
        case 6: {
          if (tag !== 50) {
            break;
          }

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

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

  fromJSON(object: any): MarketDepthData {
    return {
      position: isSet(object.position) ? globalThis.Number(object.position) : undefined,
      operation: isSet(object.operation) ? globalThis.Number(object.operation) : undefined,
      side: isSet(object.side) ? globalThis.Number(object.side) : undefined,
      price: isSet(object.price) ? globalThis.Number(object.price) : undefined,
      size: isSet(object.size) ? globalThis.String(object.size) : undefined,
      marketMaker: isSet(object.marketMaker) ? globalThis.String(object.marketMaker) : undefined,
      isSmartDepth: isSet(object.isSmartDepth) ? globalThis.Boolean(object.isSmartDepth) : undefined,
    };
  },

  toJSON(message: MarketDepthData): unknown {
    const obj: any = {};
    if (message.position !== undefined) {
      obj.position = Math.round(message.position);
    }
    if (message.operation !== undefined) {
      obj.operation = Math.round(message.operation);
    }
    if (message.side !== undefined) {
      obj.side = Math.round(message.side);
    }
    if (message.price !== undefined) {
      obj.price = message.price;
    }
    if (message.size !== undefined) {
      obj.size = message.size;
    }
    if (message.marketMaker !== undefined) {
      obj.marketMaker = message.marketMaker;
    }
    if (message.isSmartDepth !== undefined) {
      obj.isSmartDepth = message.isSmartDepth;
    }
    return obj;
  },

  create(base?: DeepPartial<MarketDepthData>): MarketDepthData {
    return MarketDepthData.fromPartial(base ?? {});
  },
  fromPartial(object: DeepPartial<MarketDepthData>): MarketDepthData {
    const message = createBaseMarketDepthData();
    message.position = object.position ?? undefined;
    message.operation = object.operation ?? undefined;
    message.side = object.side ?? undefined;
    message.price = object.price ?? undefined;
    message.size = object.size ?? undefined;
    message.marketMaker = object.marketMaker ?? undefined;
    message.isSmartDepth = object.isSmartDepth ?? 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;
}
