"use strict";

var _typeof = require("@babel/runtime/helpers/typeof");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.IncentivizedAcknowledgement = void 0;
var _m0 = _interopRequireWildcard(require("protobufjs/minimal"));
var _helpers = require("../../../../helpers");
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
//@ts-nocheck

/** IncentivizedAcknowledgement is the acknowledgement format to be used by applications wrapped in the fee middleware */

/** IncentivizedAcknowledgement is the acknowledgement format to be used by applications wrapped in the fee middleware */

function createBaseIncentivizedAcknowledgement() {
  return {
    appAcknowledgement: new Uint8Array(),
    forwardRelayerAddress: "",
    underlyingAppSuccess: false
  };
}
var IncentivizedAcknowledgement = exports.IncentivizedAcknowledgement = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.appAcknowledgement.length !== 0) {
      writer.uint32(10).bytes(message.appAcknowledgement);
    }
    if (message.forwardRelayerAddress !== "") {
      writer.uint32(18).string(message.forwardRelayerAddress);
    }
    if (message.underlyingAppSuccess === true) {
      writer.uint32(24).bool(message.underlyingAppSuccess);
    }
    return writer;
  },
  decode: function decode(input, length) {
    var reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    var end = length === undefined ? reader.len : reader.pos + length;
    var message = createBaseIncentivizedAcknowledgement();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.appAcknowledgement = reader.bytes();
          break;
        case 2:
          message.forwardRelayerAddress = reader.string();
          break;
        case 3:
          message.underlyingAppSuccess = reader.bool();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      appAcknowledgement: (0, _helpers.isSet)(object.appAcknowledgement) ? (0, _helpers.bytesFromBase64)(object.appAcknowledgement) : new Uint8Array(),
      forwardRelayerAddress: (0, _helpers.isSet)(object.forwardRelayerAddress) ? String(object.forwardRelayerAddress) : "",
      underlyingAppSuccess: (0, _helpers.isSet)(object.underlyingAppSuccess) ? Boolean(object.underlyingAppSuccess) : false
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.appAcknowledgement !== undefined && (obj.appAcknowledgement = (0, _helpers.base64FromBytes)(message.appAcknowledgement !== undefined ? message.appAcknowledgement : new Uint8Array()));
    message.forwardRelayerAddress !== undefined && (obj.forwardRelayerAddress = message.forwardRelayerAddress);
    message.underlyingAppSuccess !== undefined && (obj.underlyingAppSuccess = message.underlyingAppSuccess);
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$appAcknowledg, _object$forwardRelaye, _object$underlyingApp;
    var message = createBaseIncentivizedAcknowledgement();
    message.appAcknowledgement = (_object$appAcknowledg = object.appAcknowledgement) !== null && _object$appAcknowledg !== void 0 ? _object$appAcknowledg : new Uint8Array();
    message.forwardRelayerAddress = (_object$forwardRelaye = object.forwardRelayerAddress) !== null && _object$forwardRelaye !== void 0 ? _object$forwardRelaye : "";
    message.underlyingAppSuccess = (_object$underlyingApp = object.underlyingAppSuccess) !== null && _object$underlyingApp !== void 0 ? _object$underlyingApp : false;
    return message;
  }
};