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

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

export const protobufPackage = "protobuf";

export interface NewsBulletin {
  newsMsgId?: number | undefined;
  newsMsgType?: number | undefined;
  newsMessage?: string | undefined;
  originatingExch?: string | undefined;
}

function createBaseNewsBulletin(): NewsBulletin {
  return { newsMsgId: undefined, newsMsgType: undefined, newsMessage: undefined, originatingExch: undefined };
}

export const NewsBulletin: MessageFns<NewsBulletin> = {
  encode(message: NewsBulletin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.newsMsgId !== undefined) {
      writer.uint32(8).int32(message.newsMsgId);
    }
    if (message.newsMsgType !== undefined) {
      writer.uint32(16).int32(message.newsMsgType);
    }
    if (message.newsMessage !== undefined) {
      writer.uint32(26).string(message.newsMessage);
    }
    if (message.originatingExch !== undefined) {
      writer.uint32(34).string(message.originatingExch);
    }
    return writer;
  },

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

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

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

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

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

  fromJSON(object: any): NewsBulletin {
    return {
      newsMsgId: isSet(object.newsMsgId) ? globalThis.Number(object.newsMsgId) : undefined,
      newsMsgType: isSet(object.newsMsgType) ? globalThis.Number(object.newsMsgType) : undefined,
      newsMessage: isSet(object.newsMessage) ? globalThis.String(object.newsMessage) : undefined,
      originatingExch: isSet(object.originatingExch) ? globalThis.String(object.originatingExch) : undefined,
    };
  },

  toJSON(message: NewsBulletin): unknown {
    const obj: any = {};
    if (message.newsMsgId !== undefined) {
      obj.newsMsgId = Math.round(message.newsMsgId);
    }
    if (message.newsMsgType !== undefined) {
      obj.newsMsgType = Math.round(message.newsMsgType);
    }
    if (message.newsMessage !== undefined) {
      obj.newsMessage = message.newsMessage;
    }
    if (message.originatingExch !== undefined) {
      obj.originatingExch = message.originatingExch;
    }
    return obj;
  },

  create(base?: DeepPartial<NewsBulletin>): NewsBulletin {
    return NewsBulletin.fromPartial(base ?? {});
  },
  fromPartial(object: DeepPartial<NewsBulletin>): NewsBulletin {
    const message = createBaseNewsBulletin();
    message.newsMsgId = object.newsMsgId ?? undefined;
    message.newsMsgType = object.newsMsgType ?? undefined;
    message.newsMessage = object.newsMessage ?? undefined;
    message.originatingExch = object.originatingExch ?? 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;
}
