"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.SeriesSDKType = exports.SeriesAmino = exports.Series = exports.RewardPool = void 0;
exports.seriesFromJSON = seriesFromJSON;
exports.seriesToJSON = seriesToJSON;
var _coin = require("../cosmos/base/v1beta1/coin");
var _timestamp = require("../google/protobuf/timestamp");
var _binary = require("../binary");
var _helpers = require("../helpers");
var Series = exports.Series = /*#__PURE__*/function (Series) {
  Series[Series["NONE"] = 0] = "NONE";
  Series[Series["ONE"] = 1] = "ONE";
  Series[Series["TWO"] = 2] = "TWO";
  Series[Series["THREE"] = 3] = "THREE";
  Series[Series["FOUR"] = 4] = "FOUR";
  Series[Series["FIVE"] = 5] = "FIVE";
  Series[Series["SIX"] = 6] = "SIX";
  Series[Series["SEVEN"] = 7] = "SEVEN";
  Series[Series["COSMOS"] = 8] = "COSMOS";
  Series[Series["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
  return Series;
}({});
var SeriesSDKType = exports.SeriesSDKType = Series;
var SeriesAmino = exports.SeriesAmino = Series;
function seriesFromJSON(object) {
  switch (object) {
    case 0:
    case "NONE":
      return Series.NONE;
    case 1:
    case "ONE":
      return Series.ONE;
    case 2:
    case "TWO":
      return Series.TWO;
    case 3:
    case "THREE":
      return Series.THREE;
    case 4:
    case "FOUR":
      return Series.FOUR;
    case 5:
    case "FIVE":
      return Series.FIVE;
    case 6:
    case "SIX":
      return Series.SIX;
    case 7:
    case "SEVEN":
      return Series.SEVEN;
    case 8:
    case "COSMOS":
      return Series.COSMOS;
    case -1:
    case "UNRECOGNIZED":
    default:
      return Series.UNRECOGNIZED;
  }
}
function seriesToJSON(object) {
  switch (object) {
    case Series.NONE:
      return "NONE";
    case Series.ONE:
      return "ONE";
    case Series.TWO:
      return "TWO";
    case Series.THREE:
      return "THREE";
    case Series.FOUR:
      return "FOUR";
    case Series.FIVE:
      return "FIVE";
    case Series.SIX:
      return "SIX";
    case Series.SEVEN:
      return "SEVEN";
    case Series.COSMOS:
      return "COSMOS";
    case Series.UNRECOGNIZED:
    default:
      return "UNRECOGNIZED";
  }
}
function createBaseRewardPool() {
  return {
    totalAmount: _coin.Coin.fromPartial({}),
    claimedAmount: _coin.Coin.fromPartial({}),
    startTime: _timestamp.Timestamp.fromPartial({}),
    endTime: _timestamp.Timestamp.fromPartial({}),
    series: 0
  };
}
var RewardPool = exports.RewardPool = {
  typeUrl: "/gitopia.gitopia.rewards.RewardPool",
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _binary.BinaryWriter.create();
    if (message.totalAmount !== undefined) {
      _coin.Coin.encode(message.totalAmount, writer.uint32(10).fork()).ldelim();
    }
    if (message.claimedAmount !== undefined) {
      _coin.Coin.encode(message.claimedAmount, writer.uint32(18).fork()).ldelim();
    }
    if (message.startTime !== undefined) {
      _timestamp.Timestamp.encode(message.startTime, writer.uint32(26).fork()).ldelim();
    }
    if (message.endTime !== undefined) {
      _timestamp.Timestamp.encode(message.endTime, writer.uint32(34).fork()).ldelim();
    }
    if (message.series !== 0) {
      writer.uint32(40).int32(message.series);
    }
    return writer;
  },
  fromJSON: function fromJSON(object) {
    return {
      totalAmount: (0, _helpers.isSet)(object.totalAmount) ? _coin.Coin.fromJSON(object.totalAmount) : undefined,
      claimedAmount: (0, _helpers.isSet)(object.claimedAmount) ? _coin.Coin.fromJSON(object.claimedAmount) : undefined,
      startTime: (0, _helpers.isSet)(object.startTime) ? (0, _helpers.fromJsonTimestamp)(object.startTime) : undefined,
      endTime: (0, _helpers.isSet)(object.endTime) ? (0, _helpers.fromJsonTimestamp)(object.endTime) : undefined,
      series: (0, _helpers.isSet)(object.series) ? seriesFromJSON(object.series) : -1
    };
  },
  fromPartial: function fromPartial(object) {
    var _object$series;
    var message = createBaseRewardPool();
    message.totalAmount = object.totalAmount !== undefined && object.totalAmount !== null ? _coin.Coin.fromPartial(object.totalAmount) : undefined;
    message.claimedAmount = object.claimedAmount !== undefined && object.claimedAmount !== null ? _coin.Coin.fromPartial(object.claimedAmount) : undefined;
    message.startTime = object.startTime !== undefined && object.startTime !== null ? _timestamp.Timestamp.fromPartial(object.startTime) : undefined;
    message.endTime = object.endTime !== undefined && object.endTime !== null ? _timestamp.Timestamp.fromPartial(object.endTime) : undefined;
    message.series = (_object$series = object.series) !== null && _object$series !== void 0 ? _object$series : 0;
    return message;
  },
  fromAmino: function fromAmino(object) {
    var message = createBaseRewardPool();
    if (object.total_amount !== undefined && object.total_amount !== null) {
      message.totalAmount = _coin.Coin.fromAmino(object.total_amount);
    }
    if (object.claimed_amount !== undefined && object.claimed_amount !== null) {
      message.claimedAmount = _coin.Coin.fromAmino(object.claimed_amount);
    }
    if (object.start_time !== undefined && object.start_time !== null) {
      message.startTime = _timestamp.Timestamp.fromAmino(object.start_time);
    }
    if (object.end_time !== undefined && object.end_time !== null) {
      message.endTime = _timestamp.Timestamp.fromAmino(object.end_time);
    }
    if (object.series !== undefined && object.series !== null) {
      message.series = object.series;
    }
    return message;
  },
  toAmino: function toAmino(message) {
    var obj = {};
    obj.total_amount = message.totalAmount ? _coin.Coin.toAmino(message.totalAmount) : undefined;
    obj.claimed_amount = message.claimedAmount ? _coin.Coin.toAmino(message.claimedAmount) : undefined;
    obj.start_time = message.startTime ? _timestamp.Timestamp.toAmino(message.startTime) : undefined;
    obj.end_time = message.endTime ? _timestamp.Timestamp.toAmino(message.endTime) : undefined;
    obj.series = message.series === 0 ? undefined : message.series;
    return obj;
  },
  fromAminoMsg: function fromAminoMsg(object) {
    return RewardPool.fromAmino(object.value);
  },
  fromProtoMsg: function fromProtoMsg(message) {
    return RewardPool.decode(message.value);
  },
  toProto: function toProto(message) {
    return RewardPool.encode(message).finish();
  },
  toProtoMsg: function toProtoMsg(message) {
    return {
      typeUrl: "/gitopia.gitopia.rewards.RewardPool",
      value: RewardPool.encode(message).finish()
    };
  }
};