"use strict";

var _typeof = require("@babel/runtime/helpers/typeof");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.EpochStartEvent = exports.EpochEndEvent = void 0;
var _timestamp = require("../../../google/protobuf/timestamp");
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); }
//@ts-nocheck

function createBaseEpochStartEvent() {
  return {
    epochNumber: _helpers.Long.ZERO,
    startTime: undefined
  };
}
var EpochStartEvent = exports.EpochStartEvent = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (!message.epochNumber.isZero()) {
      writer.uint32(8).int64(message.epochNumber);
    }
    if (message.startTime !== undefined) {
      _timestamp.Timestamp.encode(message.startTime, writer.uint32(18).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 = createBaseEpochStartEvent();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.epochNumber = reader.int64();
          break;
        case 2:
          message.startTime = _timestamp.Timestamp.decode(reader, reader.uint32());
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      epochNumber: (0, _helpers.isSet)(object.epochNumber) ? _helpers.Long.fromValue(object.epochNumber) : _helpers.Long.ZERO,
      startTime: (0, _helpers.isSet)(object.startTime) ? (0, _helpers.fromJsonTimestamp)(object.startTime) : undefined
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.epochNumber !== undefined && (obj.epochNumber = (message.epochNumber || _helpers.Long.ZERO).toString());
    message.startTime !== undefined && (obj.startTime = (0, _helpers.fromTimestamp)(message.startTime).toISOString());
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var message = createBaseEpochStartEvent();
    message.epochNumber = object.epochNumber !== undefined && object.epochNumber !== null ? _helpers.Long.fromValue(object.epochNumber) : _helpers.Long.ZERO;
    message.startTime = object.startTime !== undefined && object.startTime !== null ? _timestamp.Timestamp.fromPartial(object.startTime) : undefined;
    return message;
  }
};
function createBaseEpochEndEvent() {
  return {
    epochNumber: _helpers.Long.ZERO
  };
}
var EpochEndEvent = exports.EpochEndEvent = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (!message.epochNumber.isZero()) {
      writer.uint32(8).int64(message.epochNumber);
    }
    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 = createBaseEpochEndEvent();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.epochNumber = reader.int64();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      epochNumber: (0, _helpers.isSet)(object.epochNumber) ? _helpers.Long.fromValue(object.epochNumber) : _helpers.Long.ZERO
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.epochNumber !== undefined && (obj.epochNumber = (message.epochNumber || _helpers.Long.ZERO).toString());
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var message = createBaseEpochEndEvent();
    message.epochNumber = object.epochNumber !== undefined && object.epochNumber !== null ? _helpers.Long.fromValue(object.epochNumber) : _helpers.Long.ZERO;
    return message;
  }
};