import { WireType } from "@protobuf-ts/runtime";
import { UnknownFieldHandler } from "@protobuf-ts/runtime";
import { reflectionMergePartial } from "@protobuf-ts/runtime";
import { MessageType } from "@protobuf-ts/runtime";
import { Coin } from "../../../cosmos/base/v1beta1/coin_pb.js";
class EventSetVoucher$Type extends MessageType {
  constructor() {
    super("injective.auction.v1beta1.EventSetVoucher", [
      {
        no: 1,
        name: "addr",
        kind: "scalar",
        T: 9
        /*ScalarType.STRING*/
      },
      { no: 2, name: "voucher", kind: "message", T: () => Coin, options: { "gogoproto.nullable": false, "gogoproto.customtype": "github.com/cosmos/cosmos-sdk/types.Coin" } }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.addr = "";
    if (value !== void 0)
      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 addr */
        1:
          message.addr = reader.string();
          break;
        case /* cosmos.base.v1beta1.Coin voucher */
        2:
          message.voucher = Coin.internalBinaryRead(reader, reader.uint32(), options, message.voucher);
          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 ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.addr !== "")
      writer.tag(1, WireType.LengthDelimited).string(message.addr);
    if (message.voucher)
      Coin.internalBinaryWrite(message.voucher, writer.tag(2, WireType.LengthDelimited).fork(), options).join();
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
    return writer;
  }
}
const EventSetVoucher = new EventSetVoucher$Type();
class Params$Type extends MessageType {
  constructor() {
    super("injective.auction.v1beta1.Params", [
      {
        no: 1,
        name: "auction_period",
        kind: "scalar",
        T: 3,
        L: 0
        /*LongType.BIGINT*/
      },
      { no: 2, name: "min_next_bid_increment_rate", kind: "scalar", T: 9, options: { "gogoproto.nullable": false, "gogoproto.customtype": "cosmossdk.io/math.LegacyDec" } },
      { no: 3, name: "inj_basket_max_cap", kind: "scalar", T: 9, options: { "gogoproto.nullable": false, "gogoproto.customtype": "cosmossdk.io/math.Int" } },
      {
        no: 4,
        name: "bidders_whitelist",
        kind: "scalar",
        repeat: 2,
        T: 9
        /*ScalarType.STRING*/
      }
    ], { "gogoproto.equal": true, "amino.name": "auction/Params" });
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.auctionPeriod = 0n;
    message.minNextBidIncrementRate = "";
    message.injBasketMaxCap = "";
    message.biddersWhitelist = [];
    if (value !== void 0)
      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 auction_period */
        1:
          message.auctionPeriod = reader.int64().toBigInt();
          break;
        case /* string min_next_bid_increment_rate */
        2:
          message.minNextBidIncrementRate = reader.string();
          break;
        case /* string inj_basket_max_cap */
        3:
          message.injBasketMaxCap = reader.string();
          break;
        case /* repeated string bidders_whitelist */
        4:
          message.biddersWhitelist.push(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 ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.auctionPeriod !== 0n)
      writer.tag(1, WireType.Varint).int64(message.auctionPeriod);
    if (message.minNextBidIncrementRate !== "")
      writer.tag(2, WireType.LengthDelimited).string(message.minNextBidIncrementRate);
    if (message.injBasketMaxCap !== "")
      writer.tag(3, WireType.LengthDelimited).string(message.injBasketMaxCap);
    for (let i = 0; i < message.biddersWhitelist.length; i++)
      writer.tag(4, WireType.LengthDelimited).string(message.biddersWhitelist[i]);
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
    return writer;
  }
}
const Params = new Params$Type();
class Bid$Type extends MessageType {
  constructor() {
    super("injective.auction.v1beta1.Bid", [
      { no: 1, name: "bidder", kind: "scalar", T: 9, options: { "gogoproto.jsontag": "bidder", "gogoproto.moretags": 'yaml:"bidder"' } },
      { no: 2, name: "amount", kind: "message", T: () => Coin, options: { "gogoproto.nullable": false, "gogoproto.customtype": "github.com/cosmos/cosmos-sdk/types.Coin" } }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.bidder = "";
    if (value !== void 0)
      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 bidder */
        1:
          message.bidder = reader.string();
          break;
        case /* cosmos.base.v1beta1.Coin amount */
        2:
          message.amount = Coin.internalBinaryRead(reader, reader.uint32(), options, message.amount);
          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 ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.bidder !== "")
      writer.tag(1, WireType.LengthDelimited).string(message.bidder);
    if (message.amount)
      Coin.internalBinaryWrite(message.amount, writer.tag(2, WireType.LengthDelimited).fork(), options).join();
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
    return writer;
  }
}
const Bid = new Bid$Type();
class LastAuctionResult$Type extends MessageType {
  constructor() {
    super("injective.auction.v1beta1.LastAuctionResult", [
      {
        no: 1,
        name: "winner",
        kind: "scalar",
        T: 9
        /*ScalarType.STRING*/
      },
      { no: 2, name: "amount", kind: "message", T: () => Coin, options: { "gogoproto.nullable": false, "gogoproto.customtype": "github.com/cosmos/cosmos-sdk/types.Coin" } },
      {
        no: 3,
        name: "round",
        kind: "scalar",
        T: 4,
        L: 0
        /*LongType.BIGINT*/
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.winner = "";
    message.round = 0n;
    if (value !== void 0)
      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 winner */
        1:
          message.winner = reader.string();
          break;
        case /* cosmos.base.v1beta1.Coin amount */
        2:
          message.amount = Coin.internalBinaryRead(reader, reader.uint32(), options, message.amount);
          break;
        case /* uint64 round */
        3:
          message.round = 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 ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.winner !== "")
      writer.tag(1, WireType.LengthDelimited).string(message.winner);
    if (message.amount)
      Coin.internalBinaryWrite(message.amount, writer.tag(2, WireType.LengthDelimited).fork(), options).join();
    if (message.round !== 0n)
      writer.tag(3, WireType.Varint).uint64(message.round);
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
    return writer;
  }
}
const LastAuctionResult = new LastAuctionResult$Type();
class EventBid$Type extends MessageType {
  constructor() {
    super("injective.auction.v1beta1.EventBid", [
      {
        no: 1,
        name: "bidder",
        kind: "scalar",
        T: 9
        /*ScalarType.STRING*/
      },
      { no: 2, name: "amount", kind: "message", T: () => Coin, options: { "gogoproto.nullable": false, "gogoproto.customtype": "github.com/cosmos/cosmos-sdk/types.Coin" } },
      {
        no: 3,
        name: "round",
        kind: "scalar",
        T: 4,
        L: 0
        /*LongType.BIGINT*/
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.bidder = "";
    message.round = 0n;
    if (value !== void 0)
      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 bidder */
        1:
          message.bidder = reader.string();
          break;
        case /* cosmos.base.v1beta1.Coin amount */
        2:
          message.amount = Coin.internalBinaryRead(reader, reader.uint32(), options, message.amount);
          break;
        case /* uint64 round */
        3:
          message.round = 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 ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.bidder !== "")
      writer.tag(1, WireType.LengthDelimited).string(message.bidder);
    if (message.amount)
      Coin.internalBinaryWrite(message.amount, writer.tag(2, WireType.LengthDelimited).fork(), options).join();
    if (message.round !== 0n)
      writer.tag(3, WireType.Varint).uint64(message.round);
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
    return writer;
  }
}
const EventBid = new EventBid$Type();
class EventAuctionResult$Type extends MessageType {
  constructor() {
    super("injective.auction.v1beta1.EventAuctionResult", [
      {
        no: 1,
        name: "winner",
        kind: "scalar",
        T: 9
        /*ScalarType.STRING*/
      },
      { no: 2, name: "amount", kind: "message", T: () => Coin, options: { "gogoproto.nullable": false, "gogoproto.customtype": "github.com/cosmos/cosmos-sdk/types.Coin" } },
      {
        no: 3,
        name: "round",
        kind: "scalar",
        T: 4,
        L: 0
        /*LongType.BIGINT*/
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.winner = "";
    message.round = 0n;
    if (value !== void 0)
      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 winner */
        1:
          message.winner = reader.string();
          break;
        case /* cosmos.base.v1beta1.Coin amount */
        2:
          message.amount = Coin.internalBinaryRead(reader, reader.uint32(), options, message.amount);
          break;
        case /* uint64 round */
        3:
          message.round = 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 ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.winner !== "")
      writer.tag(1, WireType.LengthDelimited).string(message.winner);
    if (message.amount)
      Coin.internalBinaryWrite(message.amount, writer.tag(2, WireType.LengthDelimited).fork(), options).join();
    if (message.round !== 0n)
      writer.tag(3, WireType.Varint).uint64(message.round);
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
    return writer;
  }
}
const EventAuctionResult = new EventAuctionResult$Type();
class EventAuctionStart$Type extends MessageType {
  constructor() {
    super("injective.auction.v1beta1.EventAuctionStart", [
      {
        no: 1,
        name: "round",
        kind: "scalar",
        T: 4,
        L: 0
        /*LongType.BIGINT*/
      },
      {
        no: 2,
        name: "ending_timestamp",
        kind: "scalar",
        T: 3,
        L: 0
        /*LongType.BIGINT*/
      },
      { no: 3, name: "new_basket", kind: "message", repeat: 2, T: () => Coin, options: { "gogoproto.nullable": false, "gogoproto.castrepeated": "github.com/cosmos/cosmos-sdk/types.Coins" } }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.round = 0n;
    message.endingTimestamp = 0n;
    message.newBasket = [];
    if (value !== void 0)
      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 round */
        1:
          message.round = reader.uint64().toBigInt();
          break;
        case /* int64 ending_timestamp */
        2:
          message.endingTimestamp = reader.int64().toBigInt();
          break;
        case /* repeated cosmos.base.v1beta1.Coin new_basket */
        3:
          message.newBasket.push(Coin.internalBinaryRead(reader, reader.uint32(), options));
          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 ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.round !== 0n)
      writer.tag(1, WireType.Varint).uint64(message.round);
    if (message.endingTimestamp !== 0n)
      writer.tag(2, WireType.Varint).int64(message.endingTimestamp);
    for (let i = 0; i < message.newBasket.length; i++)
      Coin.internalBinaryWrite(message.newBasket[i], writer.tag(3, WireType.LengthDelimited).fork(), options).join();
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
    return writer;
  }
}
const EventAuctionStart = new EventAuctionStart$Type();
export {
  Bid,
  EventAuctionResult,
  EventAuctionStart,
  EventBid,
  EventSetVoucher,
  LastAuctionResult,
  Params
};
