"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var traffic_control_parameters_exports = {};
__export(traffic_control_parameters_exports, {
  SetTrafficPurchasedMessage: () => SetTrafficPurchasedMessage,
  TrafficConsumed: () => TrafficConsumed,
  TrafficControlParameters: () => TrafficControlParameters,
  TrafficPurchased: () => TrafficPurchased,
  TrafficReceipt: () => TrafficReceipt,
  TrafficState: () => TrafficState
});
module.exports = __toCommonJS(traffic_control_parameters_exports);
var import_runtime = require("@protobuf-ts/runtime");
var import_runtime2 = require("@protobuf-ts/runtime");
var import_runtime3 = require("@protobuf-ts/runtime");
var import_runtime4 = require("@protobuf-ts/runtime");
var import_duration = require("../../../../../google/protobuf/duration.cjs");
class TrafficControlParameters$Type extends import_runtime4.MessageType {
  constructor() {
    super(
      "com.digitalasset.canton.protocol.v30.TrafficControlParameters",
      [
        {
          no: 1,
          name: "max_base_traffic_amount",
          kind: "scalar",
          T: 4,
          L: 0
        },
        {
          no: 3,
          name: "max_base_traffic_accumulation_duration",
          kind: "message",
          T: () => import_duration.Duration
        },
        {
          no: 4,
          name: "read_vs_write_scaling_factor",
          kind: "scalar",
          T: 13
        },
        {
          no: 5,
          name: "set_balance_request_submission_window_size",
          kind: "message",
          T: () => import_duration.Duration
        },
        {
          no: 6,
          name: "enforce_rate_limiting",
          kind: "scalar",
          T: 8
        },
        {
          no: 7,
          name: "base_event_cost",
          kind: "scalar",
          opt: true,
          T: 4,
          L: 0
        }
      ],
      {
        "scalapb.message": {
          companionExtends: [
            "com.digitalasset.canton.version.StableProtoVersion"
          ]
        }
      }
    );
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.maxBaseTrafficAmount = 0n;
    message.readVsWriteScalingFactor = 0;
    message.enforceRateLimiting = false;
    if (value !== void 0)
      (0, import_runtime3.reflectionMergePartial)(
        this,
        message,
        value
      );
    return message;
  }
  internalBinaryRead(reader, length, options, target) {
    let message = target ?? this.create(), end = reader.pos + length;
    while (reader.pos < end) {
      let [fieldNo, wireType] = reader.tag();
      switch (fieldNo) {
        case /* uint64 max_base_traffic_amount */
        1:
          message.maxBaseTrafficAmount = reader.uint64().toBigInt();
          break;
        case /* google.protobuf.Duration max_base_traffic_accumulation_duration */
        3:
          message.maxBaseTrafficAccumulationDuration = import_duration.Duration.internalBinaryRead(
            reader,
            reader.uint32(),
            options,
            message.maxBaseTrafficAccumulationDuration
          );
          break;
        case /* uint32 read_vs_write_scaling_factor */
        4:
          message.readVsWriteScalingFactor = reader.uint32();
          break;
        case /* google.protobuf.Duration set_balance_request_submission_window_size */
        5:
          message.setBalanceRequestSubmissionWindowSize = import_duration.Duration.internalBinaryRead(
            reader,
            reader.uint32(),
            options,
            message.setBalanceRequestSubmissionWindowSize
          );
          break;
        case /* bool enforce_rate_limiting */
        6:
          message.enforceRateLimiting = reader.bool();
          break;
        case /* optional uint64 base_event_cost */
        7:
          message.baseEventCost = reader.uint64().toBigInt();
          break;
        default:
          let u = options.readUnknownField;
          if (u === "throw")
            throw new globalThis.Error(
              `Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`
            );
          let d = reader.skip(wireType);
          if (u !== false)
            (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.maxBaseTrafficAmount !== 0n)
      writer.tag(1, import_runtime.WireType.Varint).uint64(message.maxBaseTrafficAmount);
    if (message.maxBaseTrafficAccumulationDuration)
      import_duration.Duration.internalBinaryWrite(
        message.maxBaseTrafficAccumulationDuration,
        writer.tag(3, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    if (message.readVsWriteScalingFactor !== 0)
      writer.tag(4, import_runtime.WireType.Varint).uint32(message.readVsWriteScalingFactor);
    if (message.setBalanceRequestSubmissionWindowSize)
      import_duration.Duration.internalBinaryWrite(
        message.setBalanceRequestSubmissionWindowSize,
        writer.tag(5, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    if (message.enforceRateLimiting !== false)
      writer.tag(6, import_runtime.WireType.Varint).bool(message.enforceRateLimiting);
    if (message.baseEventCost !== void 0)
      writer.tag(7, import_runtime.WireType.Varint).uint64(message.baseEventCost);
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const TrafficControlParameters = new TrafficControlParameters$Type();
class TrafficReceipt$Type extends import_runtime4.MessageType {
  constructor() {
    super(
      "com.digitalasset.canton.protocol.v30.TrafficReceipt",
      [
        {
          no: 1,
          name: "consumed_cost",
          kind: "scalar",
          T: 4,
          L: 0
        },
        {
          no: 2,
          name: "extra_traffic_consumed",
          kind: "scalar",
          T: 4,
          L: 0
        },
        {
          no: 3,
          name: "base_traffic_remainder",
          kind: "scalar",
          T: 4,
          L: 0
        }
      ],
      {
        "scalapb.message": {
          companionExtends: [
            "com.digitalasset.canton.version.StableProtoVersion"
          ]
        }
      }
    );
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.consumedCost = 0n;
    message.extraTrafficConsumed = 0n;
    message.baseTrafficRemainder = 0n;
    if (value !== void 0)
      (0, import_runtime3.reflectionMergePartial)(this, message, value);
    return message;
  }
  internalBinaryRead(reader, length, options, target) {
    let message = target ?? this.create(), end = reader.pos + length;
    while (reader.pos < end) {
      let [fieldNo, wireType] = reader.tag();
      switch (fieldNo) {
        case /* uint64 consumed_cost */
        1:
          message.consumedCost = reader.uint64().toBigInt();
          break;
        case /* uint64 extra_traffic_consumed */
        2:
          message.extraTrafficConsumed = reader.uint64().toBigInt();
          break;
        case /* uint64 base_traffic_remainder */
        3:
          message.baseTrafficRemainder = reader.uint64().toBigInt();
          break;
        default:
          let u = options.readUnknownField;
          if (u === "throw")
            throw new globalThis.Error(
              `Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`
            );
          let d = reader.skip(wireType);
          if (u !== false)
            (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.consumedCost !== 0n)
      writer.tag(1, import_runtime.WireType.Varint).uint64(message.consumedCost);
    if (message.extraTrafficConsumed !== 0n)
      writer.tag(2, import_runtime.WireType.Varint).uint64(message.extraTrafficConsumed);
    if (message.baseTrafficRemainder !== 0n)
      writer.tag(3, import_runtime.WireType.Varint).uint64(message.baseTrafficRemainder);
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const TrafficReceipt = new TrafficReceipt$Type();
class TrafficConsumed$Type extends import_runtime4.MessageType {
  constructor() {
    super(
      "com.digitalasset.canton.protocol.v30.TrafficConsumed",
      [
        {
          no: 1,
          name: "member",
          kind: "scalar",
          T: 9
        },
        {
          no: 2,
          name: "extra_traffic_consumed",
          kind: "scalar",
          T: 4,
          L: 0
        },
        {
          no: 3,
          name: "base_traffic_remainder",
          kind: "scalar",
          T: 4,
          L: 0
        },
        {
          no: 4,
          name: "last_consumed_cost",
          kind: "scalar",
          T: 4,
          L: 0
        },
        {
          no: 5,
          name: "sequencing_timestamp",
          kind: "scalar",
          T: 3,
          L: 0
        }
      ],
      {
        "scalapb.message": {
          companionExtends: [
            "com.digitalasset.canton.version.StableProtoVersion"
          ]
        }
      }
    );
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.member = "";
    message.extraTrafficConsumed = 0n;
    message.baseTrafficRemainder = 0n;
    message.lastConsumedCost = 0n;
    message.sequencingTimestamp = 0n;
    if (value !== void 0)
      (0, import_runtime3.reflectionMergePartial)(this, message, value);
    return message;
  }
  internalBinaryRead(reader, length, options, target) {
    let message = target ?? this.create(), end = reader.pos + length;
    while (reader.pos < end) {
      let [fieldNo, wireType] = reader.tag();
      switch (fieldNo) {
        case /* string member */
        1:
          message.member = reader.string();
          break;
        case /* uint64 extra_traffic_consumed */
        2:
          message.extraTrafficConsumed = reader.uint64().toBigInt();
          break;
        case /* uint64 base_traffic_remainder */
        3:
          message.baseTrafficRemainder = reader.uint64().toBigInt();
          break;
        case /* uint64 last_consumed_cost */
        4:
          message.lastConsumedCost = reader.uint64().toBigInt();
          break;
        case /* int64 sequencing_timestamp */
        5:
          message.sequencingTimestamp = reader.int64().toBigInt();
          break;
        default:
          let u = options.readUnknownField;
          if (u === "throw")
            throw new globalThis.Error(
              `Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`
            );
          let d = reader.skip(wireType);
          if (u !== false)
            (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.member !== "")
      writer.tag(1, import_runtime.WireType.LengthDelimited).string(message.member);
    if (message.extraTrafficConsumed !== 0n)
      writer.tag(2, import_runtime.WireType.Varint).uint64(message.extraTrafficConsumed);
    if (message.baseTrafficRemainder !== 0n)
      writer.tag(3, import_runtime.WireType.Varint).uint64(message.baseTrafficRemainder);
    if (message.lastConsumedCost !== 0n)
      writer.tag(4, import_runtime.WireType.Varint).uint64(message.lastConsumedCost);
    if (message.sequencingTimestamp !== 0n)
      writer.tag(5, import_runtime.WireType.Varint).int64(message.sequencingTimestamp);
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const TrafficConsumed = new TrafficConsumed$Type();
class TrafficPurchased$Type extends import_runtime4.MessageType {
  constructor() {
    super(
      "com.digitalasset.canton.protocol.v30.TrafficPurchased",
      [
        {
          no: 1,
          name: "member",
          kind: "scalar",
          T: 9
        },
        {
          no: 2,
          name: "serial",
          kind: "scalar",
          T: 13
        },
        {
          no: 3,
          name: "extra_traffic_purchased",
          kind: "scalar",
          T: 4,
          L: 0
        },
        {
          no: 4,
          name: "sequencing_timestamp",
          kind: "scalar",
          T: 3,
          L: 0
        }
      ],
      {
        "scalapb.message": {
          companionExtends: [
            "com.digitalasset.canton.version.StableProtoVersion"
          ]
        }
      }
    );
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.member = "";
    message.serial = 0;
    message.extraTrafficPurchased = 0n;
    message.sequencingTimestamp = 0n;
    if (value !== void 0)
      (0, import_runtime3.reflectionMergePartial)(this, message, value);
    return message;
  }
  internalBinaryRead(reader, length, options, target) {
    let message = target ?? this.create(), end = reader.pos + length;
    while (reader.pos < end) {
      let [fieldNo, wireType] = reader.tag();
      switch (fieldNo) {
        case /* string member */
        1:
          message.member = reader.string();
          break;
        case /* uint32 serial */
        2:
          message.serial = reader.uint32();
          break;
        case /* uint64 extra_traffic_purchased */
        3:
          message.extraTrafficPurchased = reader.uint64().toBigInt();
          break;
        case /* int64 sequencing_timestamp */
        4:
          message.sequencingTimestamp = reader.int64().toBigInt();
          break;
        default:
          let u = options.readUnknownField;
          if (u === "throw")
            throw new globalThis.Error(
              `Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`
            );
          let d = reader.skip(wireType);
          if (u !== false)
            (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.member !== "")
      writer.tag(1, import_runtime.WireType.LengthDelimited).string(message.member);
    if (message.serial !== 0)
      writer.tag(2, import_runtime.WireType.Varint).uint32(message.serial);
    if (message.extraTrafficPurchased !== 0n)
      writer.tag(3, import_runtime.WireType.Varint).uint64(message.extraTrafficPurchased);
    if (message.sequencingTimestamp !== 0n)
      writer.tag(4, import_runtime.WireType.Varint).int64(message.sequencingTimestamp);
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const TrafficPurchased = new TrafficPurchased$Type();
class TrafficState$Type extends import_runtime4.MessageType {
  constructor() {
    super("com.digitalasset.canton.protocol.v30.TrafficState", [
      {
        no: 1,
        name: "extra_traffic_purchased",
        kind: "scalar",
        T: 3,
        L: 0
      },
      {
        no: 2,
        name: "extra_traffic_consumed",
        kind: "scalar",
        T: 3,
        L: 0
      },
      {
        no: 3,
        name: "base_traffic_remainder",
        kind: "scalar",
        T: 3,
        L: 0
      },
      {
        no: 4,
        name: "last_consumed_cost",
        kind: "scalar",
        T: 4,
        L: 0
      },
      {
        no: 5,
        name: "timestamp",
        kind: "scalar",
        T: 3,
        L: 0
      },
      {
        no: 6,
        name: "serial",
        kind: "scalar",
        opt: true,
        T: 13
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.extraTrafficPurchased = 0n;
    message.extraTrafficConsumed = 0n;
    message.baseTrafficRemainder = 0n;
    message.lastConsumedCost = 0n;
    message.timestamp = 0n;
    if (value !== void 0)
      (0, import_runtime3.reflectionMergePartial)(this, message, value);
    return message;
  }
  internalBinaryRead(reader, length, options, target) {
    let message = target ?? this.create(), end = reader.pos + length;
    while (reader.pos < end) {
      let [fieldNo, wireType] = reader.tag();
      switch (fieldNo) {
        case /* int64 extra_traffic_purchased */
        1:
          message.extraTrafficPurchased = reader.int64().toBigInt();
          break;
        case /* int64 extra_traffic_consumed */
        2:
          message.extraTrafficConsumed = reader.int64().toBigInt();
          break;
        case /* int64 base_traffic_remainder */
        3:
          message.baseTrafficRemainder = reader.int64().toBigInt();
          break;
        case /* uint64 last_consumed_cost */
        4:
          message.lastConsumedCost = reader.uint64().toBigInt();
          break;
        case /* int64 timestamp */
        5:
          message.timestamp = reader.int64().toBigInt();
          break;
        case /* optional uint32 serial */
        6:
          message.serial = reader.uint32();
          break;
        default:
          let u = options.readUnknownField;
          if (u === "throw")
            throw new globalThis.Error(
              `Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`
            );
          let d = reader.skip(wireType);
          if (u !== false)
            (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.extraTrafficPurchased !== 0n)
      writer.tag(1, import_runtime.WireType.Varint).int64(message.extraTrafficPurchased);
    if (message.extraTrafficConsumed !== 0n)
      writer.tag(2, import_runtime.WireType.Varint).int64(message.extraTrafficConsumed);
    if (message.baseTrafficRemainder !== 0n)
      writer.tag(3, import_runtime.WireType.Varint).int64(message.baseTrafficRemainder);
    if (message.lastConsumedCost !== 0n)
      writer.tag(4, import_runtime.WireType.Varint).uint64(message.lastConsumedCost);
    if (message.timestamp !== 0n)
      writer.tag(5, import_runtime.WireType.Varint).int64(message.timestamp);
    if (message.serial !== void 0)
      writer.tag(6, import_runtime.WireType.Varint).uint32(message.serial);
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const TrafficState = new TrafficState$Type();
class SetTrafficPurchasedMessage$Type extends import_runtime4.MessageType {
  constructor() {
    super(
      "com.digitalasset.canton.protocol.v30.SetTrafficPurchasedMessage",
      [
        {
          no: 1,
          name: "member",
          kind: "scalar",
          T: 9
        },
        {
          no: 2,
          name: "serial",
          kind: "scalar",
          T: 13
        },
        {
          no: 4,
          name: "total_traffic_purchased",
          kind: "scalar",
          T: 4,
          L: 0
        },
        {
          no: 5,
          name: "synchronizer_id",
          kind: "scalar",
          T: 9
        }
      ],
      {
        "scalapb.message": {
          companionExtends: [
            "com.digitalasset.canton.version.StableProtoVersion"
          ]
        }
      }
    );
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.member = "";
    message.serial = 0;
    message.totalTrafficPurchased = 0n;
    message.synchronizerId = "";
    if (value !== void 0)
      (0, import_runtime3.reflectionMergePartial)(
        this,
        message,
        value
      );
    return message;
  }
  internalBinaryRead(reader, length, options, target) {
    let message = target ?? this.create(), end = reader.pos + length;
    while (reader.pos < end) {
      let [fieldNo, wireType] = reader.tag();
      switch (fieldNo) {
        case /* string member */
        1:
          message.member = reader.string();
          break;
        case /* uint32 serial */
        2:
          message.serial = reader.uint32();
          break;
        case /* uint64 total_traffic_purchased */
        4:
          message.totalTrafficPurchased = reader.uint64().toBigInt();
          break;
        case /* string synchronizer_id */
        5:
          message.synchronizerId = reader.string();
          break;
        default:
          let u = options.readUnknownField;
          if (u === "throw")
            throw new globalThis.Error(
              `Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`
            );
          let d = reader.skip(wireType);
          if (u !== false)
            (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.member !== "")
      writer.tag(1, import_runtime.WireType.LengthDelimited).string(message.member);
    if (message.serial !== 0)
      writer.tag(2, import_runtime.WireType.Varint).uint32(message.serial);
    if (message.totalTrafficPurchased !== 0n)
      writer.tag(4, import_runtime.WireType.Varint).uint64(message.totalTrafficPurchased);
    if (message.synchronizerId !== "")
      writer.tag(5, import_runtime.WireType.LengthDelimited).string(message.synchronizerId);
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const SetTrafficPurchasedMessage = new SetTrafficPurchasedMessage$Type();
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  SetTrafficPurchasedMessage,
  TrafficConsumed,
  TrafficControlParameters,
  TrafficPurchased,
  TrafficReceipt,
  TrafficState
});
//# sourceMappingURL=traffic_control_parameters.cjs.map