//@ts-nocheck
import * as _m0 from "protobufjs/minimal";
import { isSet } from "../../../../helpers";
/**
 * Metadata defines the ICS29 channel specific metadata encoded into the channel version bytestring
 * See ICS004: https://github.com/cosmos/ibc/tree/master/spec/core/ics-004-channel-and-packet-semantics#Versioning
 */

/**
 * Metadata defines the ICS29 channel specific metadata encoded into the channel version bytestring
 * See ICS004: https://github.com/cosmos/ibc/tree/master/spec/core/ics-004-channel-and-packet-semantics#Versioning
 */

function createBaseMetadata() {
  return {
    feeVersion: "",
    appVersion: ""
  };
}
export const Metadata = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.feeVersion !== "") {
      writer.uint32(10).string(message.feeVersion);
    }
    if (message.appVersion !== "") {
      writer.uint32(18).string(message.appVersion);
    }
    return writer;
  },
  decode(input, length) {
    const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    let end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseMetadata();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.feeVersion = reader.string();
          break;
        case 2:
          message.appVersion = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      feeVersion: isSet(object.feeVersion) ? String(object.feeVersion) : "",
      appVersion: isSet(object.appVersion) ? String(object.appVersion) : ""
    };
  },
  toJSON(message) {
    const obj = {};
    message.feeVersion !== undefined && (obj.feeVersion = message.feeVersion);
    message.appVersion !== undefined && (obj.appVersion = message.appVersion);
    return obj;
  },
  fromPartial(object) {
    var _object$feeVersion, _object$appVersion;
    const message = createBaseMetadata();
    message.feeVersion = (_object$feeVersion = object.feeVersion) !== null && _object$feeVersion !== void 0 ? _object$feeVersion : "";
    message.appVersion = (_object$appVersion = object.appVersion) !== null && _object$appVersion !== void 0 ? _object$appVersion : "";
    return message;
  }
};