"use strict";

var _typeof = require("@babel/runtime/helpers/typeof");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.QueryModuleStateResponse = exports.QueryModuleStateRequest = exports.QueryCurrentAuctionBasketResponse = exports.QueryCurrentAuctionBasketRequest = exports.QueryAuctionParamsResponse = exports.QueryAuctionParamsRequest = void 0;
var _auction = require("./auction");
var _coin = require("../../../cosmos/base/v1beta1/coin");
var _genesis = require("./genesis");
var _m0 = _interopRequireWildcard(require("protobufjs/minimal"));
var _helpers = require("../../../helpers");
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, 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 normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
function createBaseQueryAuctionParamsRequest() {
  return {};
}
var QueryAuctionParamsRequest = {
  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 = createBaseQueryAuctionParamsRequest();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromPartial: function fromPartial(_) {
    var message = createBaseQueryAuctionParamsRequest();
    return message;
  }
};
exports.QueryAuctionParamsRequest = QueryAuctionParamsRequest;
function createBaseQueryAuctionParamsResponse() {
  return {
    params: undefined
  };
}
var QueryAuctionParamsResponse = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.params !== undefined) {
      _auction.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 = createBaseQueryAuctionParamsResponse();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.params = _auction.Params.decode(reader, reader.uint32());
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromPartial: function fromPartial(object) {
    var message = createBaseQueryAuctionParamsResponse();
    message.params = object.params !== undefined && object.params !== null ? _auction.Params.fromPartial(object.params) : undefined;
    return message;
  }
};
exports.QueryAuctionParamsResponse = QueryAuctionParamsResponse;
function createBaseQueryCurrentAuctionBasketRequest() {
  return {};
}
var QueryCurrentAuctionBasketRequest = {
  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 = createBaseQueryCurrentAuctionBasketRequest();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromPartial: function fromPartial(_) {
    var message = createBaseQueryCurrentAuctionBasketRequest();
    return message;
  }
};
exports.QueryCurrentAuctionBasketRequest = QueryCurrentAuctionBasketRequest;
function createBaseQueryCurrentAuctionBasketResponse() {
  return {
    amount: [],
    auctionRound: _helpers.Long.UZERO,
    auctionClosingTime: _helpers.Long.ZERO,
    highestBidder: "",
    highestBidAmount: ""
  };
}
var QueryCurrentAuctionBasketResponse = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    var _iterator = _createForOfIteratorHelper(message.amount),
      _step;
    try {
      for (_iterator.s(); !(_step = _iterator.n()).done;) {
        var v = _step.value;
        _coin.Coin.encode(v, writer.uint32(10).fork()).ldelim();
      }
    } catch (err) {
      _iterator.e(err);
    } finally {
      _iterator.f();
    }
    if (!message.auctionRound.isZero()) {
      writer.uint32(16).uint64(message.auctionRound);
    }
    if (!message.auctionClosingTime.isZero()) {
      writer.uint32(24).int64(message.auctionClosingTime);
    }
    if (message.highestBidder !== "") {
      writer.uint32(34).string(message.highestBidder);
    }
    if (message.highestBidAmount !== "") {
      writer.uint32(42).string(message.highestBidAmount);
    }
    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 = createBaseQueryCurrentAuctionBasketResponse();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.amount.push(_coin.Coin.decode(reader, reader.uint32()));
          break;
        case 2:
          message.auctionRound = reader.uint64();
          break;
        case 3:
          message.auctionClosingTime = reader.int64();
          break;
        case 4:
          message.highestBidder = reader.string();
          break;
        case 5:
          message.highestBidAmount = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromPartial: function fromPartial(object) {
    var _object$amount, _object$highestBidder, _object$highestBidAmo;
    var message = createBaseQueryCurrentAuctionBasketResponse();
    message.amount = ((_object$amount = object.amount) === null || _object$amount === void 0 ? void 0 : _object$amount.map(function (e) {
      return _coin.Coin.fromPartial(e);
    })) || [];
    message.auctionRound = object.auctionRound !== undefined && object.auctionRound !== null ? _helpers.Long.fromValue(object.auctionRound) : _helpers.Long.UZERO;
    message.auctionClosingTime = object.auctionClosingTime !== undefined && object.auctionClosingTime !== null ? _helpers.Long.fromValue(object.auctionClosingTime) : _helpers.Long.ZERO;
    message.highestBidder = (_object$highestBidder = object.highestBidder) !== null && _object$highestBidder !== void 0 ? _object$highestBidder : "";
    message.highestBidAmount = (_object$highestBidAmo = object.highestBidAmount) !== null && _object$highestBidAmo !== void 0 ? _object$highestBidAmo : "";
    return message;
  }
};
exports.QueryCurrentAuctionBasketResponse = QueryCurrentAuctionBasketResponse;
function createBaseQueryModuleStateRequest() {
  return {};
}
var QueryModuleStateRequest = {
  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 = createBaseQueryModuleStateRequest();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromPartial: function fromPartial(_) {
    var message = createBaseQueryModuleStateRequest();
    return message;
  }
};
exports.QueryModuleStateRequest = QueryModuleStateRequest;
function createBaseQueryModuleStateResponse() {
  return {
    state: undefined
  };
}
var QueryModuleStateResponse = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.state !== undefined) {
      _genesis.GenesisState.encode(message.state, 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 = createBaseQueryModuleStateResponse();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.state = _genesis.GenesisState.decode(reader, reader.uint32());
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromPartial: function fromPartial(object) {
    var message = createBaseQueryModuleStateResponse();
    message.state = object.state !== undefined && object.state !== null ? _genesis.GenesisState.fromPartial(object.state) : undefined;
    return message;
  }
};
exports.QueryModuleStateResponse = QueryModuleStateResponse;