import { WireType } from "@protobuf-ts/runtime";
import { UnknownFieldHandler } from "@protobuf-ts/runtime";
import { reflectionMergePartial } from "@protobuf-ts/runtime";
import { MessageType } from "@protobuf-ts/runtime";
class PublicKey$Type extends MessageType {
  constructor() {
    super("tendermint.crypto.PublicKey", [
      {
        no: 1,
        name: "ed25519",
        kind: "scalar",
        oneof: "sum",
        T: 12
        /*ScalarType.BYTES*/
      },
      {
        no: 2,
        name: "secp256k1",
        kind: "scalar",
        jsonName: "secp256k1",
        oneof: "sum",
        T: 12
        /*ScalarType.BYTES*/
      },
      {
        no: 3,
        name: "bls12381",
        kind: "scalar",
        oneof: "sum",
        T: 12
        /*ScalarType.BYTES*/
      },
      {
        no: 4,
        name: "mldsa65",
        kind: "scalar",
        oneof: "sum",
        T: 12
        /*ScalarType.BYTES*/
      },
      {
        no: 5,
        name: "secp256k1eth",
        kind: "scalar",
        jsonName: "secp256k1eth",
        oneof: "sum",
        T: 12
        /*ScalarType.BYTES*/
      }
    ], { "gogoproto.equal": true, "gogoproto.compare": true });
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.sum = { oneofKind: void 0 };
    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 /* bytes ed25519 */
        1:
          message.sum = {
            oneofKind: "ed25519",
            ed25519: reader.bytes()
          };
          break;
        case /* bytes secp256k1 */
        2:
          message.sum = {
            oneofKind: "secp256K1",
            secp256K1: reader.bytes()
          };
          break;
        case /* bytes bls12381 */
        3:
          message.sum = {
            oneofKind: "bls12381",
            bls12381: reader.bytes()
          };
          break;
        case /* bytes mldsa65 */
        4:
          message.sum = {
            oneofKind: "mldsa65",
            mldsa65: reader.bytes()
          };
          break;
        case /* bytes secp256k1eth */
        5:
          message.sum = {
            oneofKind: "secp256K1Eth",
            secp256K1Eth: reader.bytes()
          };
          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.sum.oneofKind === "ed25519")
      writer.tag(1, WireType.LengthDelimited).bytes(message.sum.ed25519);
    if (message.sum.oneofKind === "secp256K1")
      writer.tag(2, WireType.LengthDelimited).bytes(message.sum.secp256K1);
    if (message.sum.oneofKind === "bls12381")
      writer.tag(3, WireType.LengthDelimited).bytes(message.sum.bls12381);
    if (message.sum.oneofKind === "mldsa65")
      writer.tag(4, WireType.LengthDelimited).bytes(message.sum.mldsa65);
    if (message.sum.oneofKind === "secp256K1Eth")
      writer.tag(5, WireType.LengthDelimited).bytes(message.sum.secp256K1Eth);
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
    return writer;
  }
}
const PublicKey = new PublicKey$Type();
export {
  PublicKey
};
