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

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

export const protobufPackage = "protobuf";

export interface TickOptionComputation {
  reqId?: number | undefined;
  tickType?: number | undefined;
  tickAttrib?: number | undefined;
  impliedVol?: number | undefined;
  delta?: number | undefined;
  optPrice?: number | undefined;
  pvDividend?: number | undefined;
  gamma?: number | undefined;
  vega?: number | undefined;
  theta?: number | undefined;
  undPrice?: number | undefined;
}

function createBaseTickOptionComputation(): TickOptionComputation {
  return {
    reqId: undefined,
    tickType: undefined,
    tickAttrib: undefined,
    impliedVol: undefined,
    delta: undefined,
    optPrice: undefined,
    pvDividend: undefined,
    gamma: undefined,
    vega: undefined,
    theta: undefined,
    undPrice: undefined,
  };
}

export const TickOptionComputation: MessageFns<TickOptionComputation> = {
  encode(message: TickOptionComputation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.reqId !== undefined) {
      writer.uint32(8).int32(message.reqId);
    }
    if (message.tickType !== undefined) {
      writer.uint32(16).int32(message.tickType);
    }
    if (message.tickAttrib !== undefined) {
      writer.uint32(24).int32(message.tickAttrib);
    }
    if (message.impliedVol !== undefined) {
      writer.uint32(33).double(message.impliedVol);
    }
    if (message.delta !== undefined) {
      writer.uint32(41).double(message.delta);
    }
    if (message.optPrice !== undefined) {
      writer.uint32(49).double(message.optPrice);
    }
    if (message.pvDividend !== undefined) {
      writer.uint32(57).double(message.pvDividend);
    }
    if (message.gamma !== undefined) {
      writer.uint32(65).double(message.gamma);
    }
    if (message.vega !== undefined) {
      writer.uint32(73).double(message.vega);
    }
    if (message.theta !== undefined) {
      writer.uint32(81).double(message.theta);
    }
    if (message.undPrice !== undefined) {
      writer.uint32(89).double(message.undPrice);
    }
    return writer;
  },

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

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

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

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

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

          message.delta = reader.double();
          continue;
        }
        case 6: {
          if (tag !== 49) {
            break;
          }

          message.optPrice = reader.double();
          continue;
        }
        case 7: {
          if (tag !== 57) {
            break;
          }

          message.pvDividend = reader.double();
          continue;
        }
        case 8: {
          if (tag !== 65) {
            break;
          }

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

          message.vega = reader.double();
          continue;
        }
        case 10: {
          if (tag !== 81) {
            break;
          }

          message.theta = reader.double();
          continue;
        }
        case 11: {
          if (tag !== 89) {
            break;
          }

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

  fromJSON(object: any): TickOptionComputation {
    return {
      reqId: isSet(object.reqId) ? globalThis.Number(object.reqId) : undefined,
      tickType: isSet(object.tickType) ? globalThis.Number(object.tickType) : undefined,
      tickAttrib: isSet(object.tickAttrib) ? globalThis.Number(object.tickAttrib) : undefined,
      impliedVol: isSet(object.impliedVol) ? globalThis.Number(object.impliedVol) : undefined,
      delta: isSet(object.delta) ? globalThis.Number(object.delta) : undefined,
      optPrice: isSet(object.optPrice) ? globalThis.Number(object.optPrice) : undefined,
      pvDividend: isSet(object.pvDividend) ? globalThis.Number(object.pvDividend) : undefined,
      gamma: isSet(object.gamma) ? globalThis.Number(object.gamma) : undefined,
      vega: isSet(object.vega) ? globalThis.Number(object.vega) : undefined,
      theta: isSet(object.theta) ? globalThis.Number(object.theta) : undefined,
      undPrice: isSet(object.undPrice) ? globalThis.Number(object.undPrice) : undefined,
    };
  },

  toJSON(message: TickOptionComputation): unknown {
    const obj: any = {};
    if (message.reqId !== undefined) {
      obj.reqId = Math.round(message.reqId);
    }
    if (message.tickType !== undefined) {
      obj.tickType = Math.round(message.tickType);
    }
    if (message.tickAttrib !== undefined) {
      obj.tickAttrib = Math.round(message.tickAttrib);
    }
    if (message.impliedVol !== undefined) {
      obj.impliedVol = message.impliedVol;
    }
    if (message.delta !== undefined) {
      obj.delta = message.delta;
    }
    if (message.optPrice !== undefined) {
      obj.optPrice = message.optPrice;
    }
    if (message.pvDividend !== undefined) {
      obj.pvDividend = message.pvDividend;
    }
    if (message.gamma !== undefined) {
      obj.gamma = message.gamma;
    }
    if (message.vega !== undefined) {
      obj.vega = message.vega;
    }
    if (message.theta !== undefined) {
      obj.theta = message.theta;
    }
    if (message.undPrice !== undefined) {
      obj.undPrice = message.undPrice;
    }
    return obj;
  },

  create(base?: DeepPartial<TickOptionComputation>): TickOptionComputation {
    return TickOptionComputation.fromPartial(base ?? {});
  },
  fromPartial(object: DeepPartial<TickOptionComputation>): TickOptionComputation {
    const message = createBaseTickOptionComputation();
    message.reqId = object.reqId ?? undefined;
    message.tickType = object.tickType ?? undefined;
    message.tickAttrib = object.tickAttrib ?? undefined;
    message.impliedVol = object.impliedVol ?? undefined;
    message.delta = object.delta ?? undefined;
    message.optPrice = object.optPrice ?? undefined;
    message.pvDividend = object.pvDividend ?? undefined;
    message.gamma = object.gamma ?? undefined;
    message.vega = object.vega ?? undefined;
    message.theta = object.theta ?? undefined;
    message.undPrice = object.undPrice ?? 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;
}
