//@ts-nocheck
import { Params, LiquidValidator } from "./liquidstake";
import * as _m0 from "protobufjs/minimal";
import { isSet } from "../../../helpers";
/** GenesisState defines the liquidstake module's genesis state. */

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

function createBaseGenesisState() {
  return {
    params: undefined,
    liquidValidators: []
  };
}
export const GenesisState = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.params !== undefined) {
      Params.encode(message.params, writer.uint32(10).fork()).ldelim();
    }
    for (const v of message.liquidValidators) {
      LiquidValidator.encode(v, writer.uint32(18).fork()).ldelim();
    }
    return writer;
  },
  decode(input, length) {
    const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    let end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseGenesisState();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.params = Params.decode(reader, reader.uint32());
          break;
        case 2:
          message.liquidValidators.push(LiquidValidator.decode(reader, reader.uint32()));
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      params: isSet(object.params) ? Params.fromJSON(object.params) : undefined,
      liquidValidators: Array.isArray(object === null || object === void 0 ? void 0 : object.liquidValidators) ? object.liquidValidators.map(e => LiquidValidator.fromJSON(e)) : []
    };
  },
  toJSON(message) {
    const obj = {};
    message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined);
    if (message.liquidValidators) {
      obj.liquidValidators = message.liquidValidators.map(e => e ? LiquidValidator.toJSON(e) : undefined);
    } else {
      obj.liquidValidators = [];
    }
    return obj;
  },
  fromPartial(object) {
    var _object$liquidValidat;
    const message = createBaseGenesisState();
    message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined;
    message.liquidValidators = ((_object$liquidValidat = object.liquidValidators) === null || _object$liquidValidat === void 0 ? void 0 : _object$liquidValidat.map(e => LiquidValidator.fromPartial(e))) || [];
    return message;
  }
};