"use strict";

var _typeof = require("@babel/runtime/helpers/typeof");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.QueryParamsResponse = exports.QueryParamsRequest = exports.GetAuthenticatorsResponse = exports.GetAuthenticatorsRequest = exports.GetAuthenticatorResponse = exports.GetAuthenticatorRequest = void 0;
var _params = require("./params");
var _models = require("./models");
var _helpers = require("../../../helpers");
var _m0 = _interopRequireWildcard(require("protobufjs/minimal"));
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); }
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } //@ts-nocheck
/** QueryParamsRequest is request type for the Query/Params RPC method. */

/** QueryParamsRequest is request type for the Query/Params RPC method. */

/** QueryParamsResponse is response type for the Query/Params RPC method. */

/** QueryParamsResponse is response type for the Query/Params RPC method. */

/** MsgGetAuthenticatorsRequest defines the Msg/GetAuthenticators request type. */

/** MsgGetAuthenticatorsRequest defines the Msg/GetAuthenticators request type. */

/** MsgGetAuthenticatorsResponse defines the Msg/GetAuthenticators response type. */

/** MsgGetAuthenticatorsResponse defines the Msg/GetAuthenticators response type. */

/** MsgGetAuthenticatorRequest defines the Msg/GetAuthenticator request type. */

/** MsgGetAuthenticatorRequest defines the Msg/GetAuthenticator request type. */

/** MsgGetAuthenticatorResponse defines the Msg/GetAuthenticator response type. */

/** MsgGetAuthenticatorResponse defines the Msg/GetAuthenticator response type. */

function createBaseQueryParamsRequest() {
  return {};
}
var QueryParamsRequest = exports.QueryParamsRequest = {
  encode: function encode(_) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    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 = createBaseQueryParamsRequest();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(_) {
    return {};
  },
  toJSON: function toJSON(_) {
    var obj = {};
    return obj;
  },
  fromPartial: function fromPartial(_) {
    var message = createBaseQueryParamsRequest();
    return message;
  }
};
function createBaseQueryParamsResponse() {
  return {
    params: undefined
  };
}
var QueryParamsResponse = exports.QueryParamsResponse = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.params !== undefined) {
      _params.Params.encode(message.params, writer.uint32(10).fork()).ldelim();
    }
    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 = createBaseQueryParamsResponse();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.params = _params.Params.decode(reader, reader.uint32());
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      params: (0, _helpers.isSet)(object.params) ? _params.Params.fromJSON(object.params) : undefined
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.params !== undefined && (obj.params = message.params ? _params.Params.toJSON(message.params) : undefined);
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var message = createBaseQueryParamsResponse();
    message.params = object.params !== undefined && object.params !== null ? _params.Params.fromPartial(object.params) : undefined;
    return message;
  }
};
function createBaseGetAuthenticatorsRequest() {
  return {
    account: ""
  };
}
var GetAuthenticatorsRequest = exports.GetAuthenticatorsRequest = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.account !== "") {
      writer.uint32(10).string(message.account);
    }
    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 = createBaseGetAuthenticatorsRequest();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.account = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      account: (0, _helpers.isSet)(object.account) ? String(object.account) : ""
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.account !== undefined && (obj.account = message.account);
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$account;
    var message = createBaseGetAuthenticatorsRequest();
    message.account = (_object$account = object.account) !== null && _object$account !== void 0 ? _object$account : "";
    return message;
  }
};
function createBaseGetAuthenticatorsResponse() {
  return {
    accountAuthenticators: []
  };
}
var GetAuthenticatorsResponse = exports.GetAuthenticatorsResponse = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    var _iterator = _createForOfIteratorHelper(message.accountAuthenticators),
      _step;
    try {
      for (_iterator.s(); !(_step = _iterator.n()).done;) {
        var v = _step.value;
        _models.AccountAuthenticator.encode(v, writer.uint32(10).fork()).ldelim();
      }
    } catch (err) {
      _iterator.e(err);
    } finally {
      _iterator.f();
    }
    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 = createBaseGetAuthenticatorsResponse();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.accountAuthenticators.push(_models.AccountAuthenticator.decode(reader, reader.uint32()));
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      accountAuthenticators: Array.isArray(object === null || object === void 0 ? void 0 : object.accountAuthenticators) ? object.accountAuthenticators.map(function (e) {
        return _models.AccountAuthenticator.fromJSON(e);
      }) : []
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    if (message.accountAuthenticators) {
      obj.accountAuthenticators = message.accountAuthenticators.map(function (e) {
        return e ? _models.AccountAuthenticator.toJSON(e) : undefined;
      });
    } else {
      obj.accountAuthenticators = [];
    }
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$accountAuthen;
    var message = createBaseGetAuthenticatorsResponse();
    message.accountAuthenticators = ((_object$accountAuthen = object.accountAuthenticators) === null || _object$accountAuthen === void 0 ? void 0 : _object$accountAuthen.map(function (e) {
      return _models.AccountAuthenticator.fromPartial(e);
    })) || [];
    return message;
  }
};
function createBaseGetAuthenticatorRequest() {
  return {
    account: "",
    authenticatorId: _helpers.Long.UZERO
  };
}
var GetAuthenticatorRequest = exports.GetAuthenticatorRequest = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.account !== "") {
      writer.uint32(10).string(message.account);
    }
    if (!message.authenticatorId.isZero()) {
      writer.uint32(16).uint64(message.authenticatorId);
    }
    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 = createBaseGetAuthenticatorRequest();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.account = reader.string();
          break;
        case 2:
          message.authenticatorId = reader.uint64();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      account: (0, _helpers.isSet)(object.account) ? String(object.account) : "",
      authenticatorId: (0, _helpers.isSet)(object.authenticatorId) ? _helpers.Long.fromValue(object.authenticatorId) : _helpers.Long.UZERO
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.account !== undefined && (obj.account = message.account);
    message.authenticatorId !== undefined && (obj.authenticatorId = (message.authenticatorId || _helpers.Long.UZERO).toString());
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$account2;
    var message = createBaseGetAuthenticatorRequest();
    message.account = (_object$account2 = object.account) !== null && _object$account2 !== void 0 ? _object$account2 : "";
    message.authenticatorId = object.authenticatorId !== undefined && object.authenticatorId !== null ? _helpers.Long.fromValue(object.authenticatorId) : _helpers.Long.UZERO;
    return message;
  }
};
function createBaseGetAuthenticatorResponse() {
  return {
    accountAuthenticator: undefined
  };
}
var GetAuthenticatorResponse = exports.GetAuthenticatorResponse = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.accountAuthenticator !== undefined) {
      _models.AccountAuthenticator.encode(message.accountAuthenticator, writer.uint32(10).fork()).ldelim();
    }
    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 = createBaseGetAuthenticatorResponse();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.accountAuthenticator = _models.AccountAuthenticator.decode(reader, reader.uint32());
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      accountAuthenticator: (0, _helpers.isSet)(object.accountAuthenticator) ? _models.AccountAuthenticator.fromJSON(object.accountAuthenticator) : undefined
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.accountAuthenticator !== undefined && (obj.accountAuthenticator = message.accountAuthenticator ? _models.AccountAuthenticator.toJSON(message.accountAuthenticator) : undefined);
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var message = createBaseGetAuthenticatorResponse();
    message.accountAuthenticator = object.accountAuthenticator !== undefined && object.accountAuthenticator !== null ? _models.AccountAuthenticator.fromPartial(object.accountAuthenticator) : undefined;
    return message;
  }
};