import { ServiceType } from "@protobuf-ts/runtime-rpc";
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 { Params } from "./insurance_pb.js";
import { Coin } from "../../../cosmos/base/v1beta1/coin_pb.js";
import { OracleType } from "../../oracle/v1beta1/oracle_pb.js";
class MsgCreateInsuranceFund$Type extends MessageType {
  constructor() {
    super("injective.insurance.v1beta1.MsgCreateInsuranceFund", [
      {
        no: 1,
        name: "sender",
        kind: "scalar",
        T: 9
        /*ScalarType.STRING*/
      },
      {
        no: 2,
        name: "ticker",
        kind: "scalar",
        T: 9
        /*ScalarType.STRING*/
      },
      {
        no: 3,
        name: "quote_denom",
        kind: "scalar",
        T: 9
        /*ScalarType.STRING*/
      },
      {
        no: 4,
        name: "oracle_base",
        kind: "scalar",
        T: 9
        /*ScalarType.STRING*/
      },
      {
        no: 5,
        name: "oracle_quote",
        kind: "scalar",
        T: 9
        /*ScalarType.STRING*/
      },
      { no: 6, name: "oracle_type", kind: "enum", T: () => ["injective.oracle.v1beta1.OracleType", OracleType] },
      {
        no: 7,
        name: "expiry",
        kind: "scalar",
        T: 3,
        L: 0
        /*LongType.BIGINT*/
      },
      { no: 8, name: "initial_deposit", kind: "message", T: () => Coin, options: { "gogoproto.nullable": false } }
    ], { "gogoproto.goproto_getters": false, "gogoproto.equal": false, "amino.name": "insurance/MsgCreateInsuranceFund", "cosmos.msg.v1.signer": ["sender"] });
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.sender = "";
    message.ticker = "";
    message.quoteDenom = "";
    message.oracleBase = "";
    message.oracleQuote = "";
    message.oracleType = 0;
    message.expiry = 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 sender */
        1:
          message.sender = reader.string();
          break;
        case /* string ticker */
        2:
          message.ticker = reader.string();
          break;
        case /* string quote_denom */
        3:
          message.quoteDenom = reader.string();
          break;
        case /* string oracle_base */
        4:
          message.oracleBase = reader.string();
          break;
        case /* string oracle_quote */
        5:
          message.oracleQuote = reader.string();
          break;
        case /* injective.oracle.v1beta1.OracleType oracle_type */
        6:
          message.oracleType = reader.int32();
          break;
        case /* int64 expiry */
        7:
          message.expiry = reader.int64().toBigInt();
          break;
        case /* cosmos.base.v1beta1.Coin initial_deposit */
        8:
          message.initialDeposit = Coin.internalBinaryRead(reader, reader.uint32(), options, message.initialDeposit);
          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.sender !== "")
      writer.tag(1, WireType.LengthDelimited).string(message.sender);
    if (message.ticker !== "")
      writer.tag(2, WireType.LengthDelimited).string(message.ticker);
    if (message.quoteDenom !== "")
      writer.tag(3, WireType.LengthDelimited).string(message.quoteDenom);
    if (message.oracleBase !== "")
      writer.tag(4, WireType.LengthDelimited).string(message.oracleBase);
    if (message.oracleQuote !== "")
      writer.tag(5, WireType.LengthDelimited).string(message.oracleQuote);
    if (message.oracleType !== 0)
      writer.tag(6, WireType.Varint).int32(message.oracleType);
    if (message.expiry !== 0n)
      writer.tag(7, WireType.Varint).int64(message.expiry);
    if (message.initialDeposit)
      Coin.internalBinaryWrite(message.initialDeposit, writer.tag(8, WireType.LengthDelimited).fork(), options).join();
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
    return writer;
  }
}
const MsgCreateInsuranceFund = new MsgCreateInsuranceFund$Type();
class MsgCreateInsuranceFundResponse$Type extends MessageType {
  constructor() {
    super("injective.insurance.v1beta1.MsgCreateInsuranceFundResponse", []);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    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) {
        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) {
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
    return writer;
  }
}
const MsgCreateInsuranceFundResponse = new MsgCreateInsuranceFundResponse$Type();
class MsgUnderwrite$Type extends MessageType {
  constructor() {
    super("injective.insurance.v1beta1.MsgUnderwrite", [
      {
        no: 1,
        name: "sender",
        kind: "scalar",
        T: 9
        /*ScalarType.STRING*/
      },
      {
        no: 2,
        name: "market_id",
        kind: "scalar",
        T: 9
        /*ScalarType.STRING*/
      },
      { no: 3, name: "deposit", kind: "message", T: () => Coin, options: { "gogoproto.nullable": false } }
    ], { "gogoproto.goproto_getters": false, "gogoproto.equal": false, "amino.name": "insurance/MsgUnderwrite", "cosmos.msg.v1.signer": ["sender"] });
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.sender = "";
    message.marketId = "";
    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 sender */
        1:
          message.sender = reader.string();
          break;
        case /* string market_id */
        2:
          message.marketId = reader.string();
          break;
        case /* cosmos.base.v1beta1.Coin deposit */
        3:
          message.deposit = Coin.internalBinaryRead(reader, reader.uint32(), options, message.deposit);
          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.sender !== "")
      writer.tag(1, WireType.LengthDelimited).string(message.sender);
    if (message.marketId !== "")
      writer.tag(2, WireType.LengthDelimited).string(message.marketId);
    if (message.deposit)
      Coin.internalBinaryWrite(message.deposit, 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 MsgUnderwrite = new MsgUnderwrite$Type();
class MsgUnderwriteResponse$Type extends MessageType {
  constructor() {
    super("injective.insurance.v1beta1.MsgUnderwriteResponse", []);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    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) {
        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) {
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
    return writer;
  }
}
const MsgUnderwriteResponse = new MsgUnderwriteResponse$Type();
class MsgRequestRedemption$Type extends MessageType {
  constructor() {
    super("injective.insurance.v1beta1.MsgRequestRedemption", [
      {
        no: 1,
        name: "sender",
        kind: "scalar",
        T: 9
        /*ScalarType.STRING*/
      },
      {
        no: 2,
        name: "market_id",
        kind: "scalar",
        T: 9
        /*ScalarType.STRING*/
      },
      { no: 3, name: "amount", kind: "message", T: () => Coin, options: { "gogoproto.nullable": false } }
    ], { "gogoproto.goproto_getters": false, "gogoproto.equal": false, "amino.name": "insurance/MsgRequestRedemption", "cosmos.msg.v1.signer": ["sender"] });
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.sender = "";
    message.marketId = "";
    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 sender */
        1:
          message.sender = reader.string();
          break;
        case /* string market_id */
        2:
          message.marketId = reader.string();
          break;
        case /* cosmos.base.v1beta1.Coin amount */
        3:
          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.sender !== "")
      writer.tag(1, WireType.LengthDelimited).string(message.sender);
    if (message.marketId !== "")
      writer.tag(2, WireType.LengthDelimited).string(message.marketId);
    if (message.amount)
      Coin.internalBinaryWrite(message.amount, 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 MsgRequestRedemption = new MsgRequestRedemption$Type();
class MsgRequestRedemptionResponse$Type extends MessageType {
  constructor() {
    super("injective.insurance.v1beta1.MsgRequestRedemptionResponse", []);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    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) {
        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) {
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
    return writer;
  }
}
const MsgRequestRedemptionResponse = new MsgRequestRedemptionResponse$Type();
class MsgUpdateParams$Type extends MessageType {
  constructor() {
    super("injective.insurance.v1beta1.MsgUpdateParams", [
      { no: 1, name: "authority", kind: "scalar", T: 9, options: { "cosmos_proto.scalar": "cosmos.AddressString" } },
      { no: 2, name: "params", kind: "message", T: () => Params, options: { "gogoproto.nullable": false } }
    ], { "amino.name": "insurance/MsgUpdateParams", "cosmos.msg.v1.signer": ["authority"] });
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.authority = "";
    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 authority */
        1:
          message.authority = reader.string();
          break;
        case /* injective.insurance.v1beta1.Params params */
        2:
          message.params = Params.internalBinaryRead(reader, reader.uint32(), options, message.params);
          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.authority !== "")
      writer.tag(1, WireType.LengthDelimited).string(message.authority);
    if (message.params)
      Params.internalBinaryWrite(message.params, 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 MsgUpdateParams = new MsgUpdateParams$Type();
class MsgUpdateParamsResponse$Type extends MessageType {
  constructor() {
    super("injective.insurance.v1beta1.MsgUpdateParamsResponse", []);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    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) {
        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) {
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
    return writer;
  }
}
const MsgUpdateParamsResponse = new MsgUpdateParamsResponse$Type();
class MsgClaimVoucher$Type extends MessageType {
  constructor() {
    super("injective.insurance.v1beta1.MsgClaimVoucher", [
      {
        no: 1,
        name: "sender",
        kind: "scalar",
        T: 9
        /*ScalarType.STRING*/
      },
      {
        no: 2,
        name: "denom",
        kind: "scalar",
        T: 9
        /*ScalarType.STRING*/
      }
    ], { "gogoproto.goproto_getters": false, "gogoproto.equal": false, "amino.name": "insurance/MsgClaimVoucher", "cosmos.msg.v1.signer": ["sender"] });
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.sender = "";
    message.denom = "";
    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 sender */
        1:
          message.sender = reader.string();
          break;
        case /* string denom */
        2:
          message.denom = 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.sender !== "")
      writer.tag(1, WireType.LengthDelimited).string(message.sender);
    if (message.denom !== "")
      writer.tag(2, WireType.LengthDelimited).string(message.denom);
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
    return writer;
  }
}
const MsgClaimVoucher = new MsgClaimVoucher$Type();
class MsgClaimVoucherResponse$Type extends MessageType {
  constructor() {
    super("injective.insurance.v1beta1.MsgClaimVoucherResponse", []);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    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) {
        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) {
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
    return writer;
  }
}
const MsgClaimVoucherResponse = new MsgClaimVoucherResponse$Type();
const Msg = new ServiceType("injective.insurance.v1beta1.Msg", [
  { name: "CreateInsuranceFund", options: {}, I: MsgCreateInsuranceFund, O: MsgCreateInsuranceFundResponse },
  { name: "Underwrite", options: {}, I: MsgUnderwrite, O: MsgUnderwriteResponse },
  { name: "RequestRedemption", options: {}, I: MsgRequestRedemption, O: MsgRequestRedemptionResponse },
  { name: "UpdateParams", options: {}, I: MsgUpdateParams, O: MsgUpdateParamsResponse },
  { name: "ClaimVoucher", options: {}, I: MsgClaimVoucher, O: MsgClaimVoucherResponse }
], { "cosmos.msg.v1.service": true });
export {
  Msg,
  MsgClaimVoucher,
  MsgClaimVoucherResponse,
  MsgCreateInsuranceFund,
  MsgCreateInsuranceFundResponse,
  MsgRequestRedemption,
  MsgRequestRedemptionResponse,
  MsgUnderwrite,
  MsgUnderwriteResponse,
  MsgUpdateParams,
  MsgUpdateParamsResponse
};
