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

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

export const protobufPackage = "protobuf";

export interface DepthMarketDataDescription {
  exchange?: string | undefined;
  secType?: string | undefined;
  listingExch?: string | undefined;
  serviceDataType?: string | undefined;
  aggGroup?: number | undefined;
}

function createBaseDepthMarketDataDescription(): DepthMarketDataDescription {
  return {
    exchange: undefined,
    secType: undefined,
    listingExch: undefined,
    serviceDataType: undefined,
    aggGroup: undefined,
  };
}

export const DepthMarketDataDescription: MessageFns<DepthMarketDataDescription> = {
  encode(message: DepthMarketDataDescription, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.exchange !== undefined) {
      writer.uint32(10).string(message.exchange);
    }
    if (message.secType !== undefined) {
      writer.uint32(18).string(message.secType);
    }
    if (message.listingExch !== undefined) {
      writer.uint32(26).string(message.listingExch);
    }
    if (message.serviceDataType !== undefined) {
      writer.uint32(34).string(message.serviceDataType);
    }
    if (message.aggGroup !== undefined) {
      writer.uint32(40).int32(message.aggGroup);
    }
    return writer;
  },

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

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

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

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

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

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

  fromJSON(object: any): DepthMarketDataDescription {
    return {
      exchange: isSet(object.exchange) ? globalThis.String(object.exchange) : undefined,
      secType: isSet(object.secType) ? globalThis.String(object.secType) : undefined,
      listingExch: isSet(object.listingExch) ? globalThis.String(object.listingExch) : undefined,
      serviceDataType: isSet(object.serviceDataType) ? globalThis.String(object.serviceDataType) : undefined,
      aggGroup: isSet(object.aggGroup) ? globalThis.Number(object.aggGroup) : undefined,
    };
  },

  toJSON(message: DepthMarketDataDescription): unknown {
    const obj: any = {};
    if (message.exchange !== undefined) {
      obj.exchange = message.exchange;
    }
    if (message.secType !== undefined) {
      obj.secType = message.secType;
    }
    if (message.listingExch !== undefined) {
      obj.listingExch = message.listingExch;
    }
    if (message.serviceDataType !== undefined) {
      obj.serviceDataType = message.serviceDataType;
    }
    if (message.aggGroup !== undefined) {
      obj.aggGroup = Math.round(message.aggGroup);
    }
    return obj;
  },

  create(base?: DeepPartial<DepthMarketDataDescription>): DepthMarketDataDescription {
    return DepthMarketDataDescription.fromPartial(base ?? {});
  },
  fromPartial(object: DeepPartial<DepthMarketDataDescription>): DepthMarketDataDescription {
    const message = createBaseDepthMarketDataDescription();
    message.exchange = object.exchange ?? undefined;
    message.secType = object.secType ?? undefined;
    message.listingExch = object.listingExch ?? undefined;
    message.serviceDataType = object.serviceDataType ?? undefined;
    message.aggGroup = object.aggGroup ?? 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;
}
