"use strict";

var _typeof = require("@babel/runtime/helpers/typeof");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.GenesisState = void 0;
var _genesis = require("../../client/v1/genesis");
var _genesis2 = require("../../connection/v1/genesis");
var _genesis3 = require("../../channel/v1/genesis");
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

/** GenesisState defines the ibc module's genesis state. */

/** GenesisState defines the ibc module's genesis state. */

function createBaseGenesisState() {
  return {
    clientGenesis: undefined,
    connectionGenesis: undefined,
    channelGenesis: undefined
  };
}
var GenesisState = exports.GenesisState = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.clientGenesis !== undefined) {
      _genesis.GenesisState.encode(message.clientGenesis, writer.uint32(10).fork()).ldelim();
    }
    if (message.connectionGenesis !== undefined) {
      _genesis2.GenesisState.encode(message.connectionGenesis, writer.uint32(18).fork()).ldelim();
    }
    if (message.channelGenesis !== undefined) {
      _genesis3.GenesisState.encode(message.channelGenesis, writer.uint32(26).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 = createBaseGenesisState();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.clientGenesis = _genesis.GenesisState.decode(reader, reader.uint32());
          break;
        case 2:
          message.connectionGenesis = _genesis2.GenesisState.decode(reader, reader.uint32());
          break;
        case 3:
          message.channelGenesis = _genesis3.GenesisState.decode(reader, reader.uint32());
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      clientGenesis: (0, _helpers.isSet)(object.clientGenesis) ? _genesis.GenesisState.fromJSON(object.clientGenesis) : undefined,
      connectionGenesis: (0, _helpers.isSet)(object.connectionGenesis) ? _genesis2.GenesisState.fromJSON(object.connectionGenesis) : undefined,
      channelGenesis: (0, _helpers.isSet)(object.channelGenesis) ? _genesis3.GenesisState.fromJSON(object.channelGenesis) : undefined
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.clientGenesis !== undefined && (obj.clientGenesis = message.clientGenesis ? _genesis.GenesisState.toJSON(message.clientGenesis) : undefined);
    message.connectionGenesis !== undefined && (obj.connectionGenesis = message.connectionGenesis ? _genesis2.GenesisState.toJSON(message.connectionGenesis) : undefined);
    message.channelGenesis !== undefined && (obj.channelGenesis = message.channelGenesis ? _genesis3.GenesisState.toJSON(message.channelGenesis) : undefined);
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var message = createBaseGenesisState();
    message.clientGenesis = object.clientGenesis !== undefined && object.clientGenesis !== null ? _genesis.GenesisState.fromPartial(object.clientGenesis) : undefined;
    message.connectionGenesis = object.connectionGenesis !== undefined && object.connectionGenesis !== null ? _genesis2.GenesisState.fromPartial(object.connectionGenesis) : undefined;
    message.channelGenesis = object.channelGenesis !== undefined && object.channelGenesis !== null ? _genesis3.GenesisState.fromPartial(object.channelGenesis) : undefined;
    return message;
  }
};