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

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

export const protobufPackage = "protobuf";

export interface CommissionAndFeesReport {
  execId?: string | undefined;
  commissionAndFees?: number | undefined;
  currency?: string | undefined;
  realizedPNL?: number | undefined;
  bondYield?: number | undefined;
  yieldRedemptionDate?: string | undefined;
}

function createBaseCommissionAndFeesReport(): CommissionAndFeesReport {
  return {
    execId: undefined,
    commissionAndFees: undefined,
    currency: undefined,
    realizedPNL: undefined,
    bondYield: undefined,
    yieldRedemptionDate: undefined,
  };
}

export const CommissionAndFeesReport: MessageFns<CommissionAndFeesReport> = {
  encode(message: CommissionAndFeesReport, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.execId !== undefined) {
      writer.uint32(10).string(message.execId);
    }
    if (message.commissionAndFees !== undefined) {
      writer.uint32(17).double(message.commissionAndFees);
    }
    if (message.currency !== undefined) {
      writer.uint32(26).string(message.currency);
    }
    if (message.realizedPNL !== undefined) {
      writer.uint32(33).double(message.realizedPNL);
    }
    if (message.bondYield !== undefined) {
      writer.uint32(41).double(message.bondYield);
    }
    if (message.yieldRedemptionDate !== undefined) {
      writer.uint32(50).string(message.yieldRedemptionDate);
    }
    return writer;
  },

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

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

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

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

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

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

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

  fromJSON(object: any): CommissionAndFeesReport {
    return {
      execId: isSet(object.execId) ? globalThis.String(object.execId) : undefined,
      commissionAndFees: isSet(object.commissionAndFees) ? globalThis.Number(object.commissionAndFees) : undefined,
      currency: isSet(object.currency) ? globalThis.String(object.currency) : undefined,
      realizedPNL: isSet(object.realizedPNL) ? globalThis.Number(object.realizedPNL) : undefined,
      bondYield: isSet(object.bondYield) ? globalThis.Number(object.bondYield) : undefined,
      yieldRedemptionDate: isSet(object.yieldRedemptionDate)
        ? globalThis.String(object.yieldRedemptionDate)
        : undefined,
    };
  },

  toJSON(message: CommissionAndFeesReport): unknown {
    const obj: any = {};
    if (message.execId !== undefined) {
      obj.execId = message.execId;
    }
    if (message.commissionAndFees !== undefined) {
      obj.commissionAndFees = message.commissionAndFees;
    }
    if (message.currency !== undefined) {
      obj.currency = message.currency;
    }
    if (message.realizedPNL !== undefined) {
      obj.realizedPNL = message.realizedPNL;
    }
    if (message.bondYield !== undefined) {
      obj.bondYield = message.bondYield;
    }
    if (message.yieldRedemptionDate !== undefined) {
      obj.yieldRedemptionDate = message.yieldRedemptionDate;
    }
    return obj;
  },

  create(base?: DeepPartial<CommissionAndFeesReport>): CommissionAndFeesReport {
    return CommissionAndFeesReport.fromPartial(base ?? {});
  },
  fromPartial(object: DeepPartial<CommissionAndFeesReport>): CommissionAndFeesReport {
    const message = createBaseCommissionAndFeesReport();
    message.execId = object.execId ?? undefined;
    message.commissionAndFees = object.commissionAndFees ?? undefined;
    message.currency = object.currency ?? undefined;
    message.realizedPNL = object.realizedPNL ?? undefined;
    message.bondYield = object.bondYield ?? undefined;
    message.yieldRedemptionDate = object.yieldRedemptionDate ?? 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;
}
