//@ts-nocheck
import { Params, QueryRequest } from "./host";
import { Long, isSet, bytesFromBase64, base64FromBytes } from "../../../../../helpers";
import * as _m0 from "protobufjs/minimal";
/** MsgUpdateParams defines the payload for Msg/UpdateParams */

/** MsgUpdateParams defines the payload for Msg/UpdateParams */

/** MsgUpdateParamsResponse defines the response for Msg/UpdateParams */

/** MsgUpdateParamsResponse defines the response for Msg/UpdateParams */

/** MsgModuleQuerySafe defines the payload for Msg/ModuleQuerySafe */

/** MsgModuleQuerySafe defines the payload for Msg/ModuleQuerySafe */

/** MsgModuleQuerySafeResponse defines the response for Msg/ModuleQuerySafe */

/** MsgModuleQuerySafeResponse defines the response for Msg/ModuleQuerySafe */

function createBaseMsgUpdateParams() {
  return {
    signer: "",
    params: undefined
  };
}
export const MsgUpdateParams = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.signer !== "") {
      writer.uint32(10).string(message.signer);
    }
    if (message.params !== undefined) {
      Params.encode(message.params, 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 = createBaseMsgUpdateParams();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.signer = reader.string();
          break;
        case 2:
          message.params = Params.decode(reader, reader.uint32());
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      signer: isSet(object.signer) ? String(object.signer) : "",
      params: isSet(object.params) ? Params.fromJSON(object.params) : undefined
    };
  },
  toJSON(message) {
    const obj = {};
    message.signer !== undefined && (obj.signer = message.signer);
    message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined);
    return obj;
  },
  fromPartial(object) {
    var _object$signer;
    const message = createBaseMsgUpdateParams();
    message.signer = (_object$signer = object.signer) !== null && _object$signer !== void 0 ? _object$signer : "";
    message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined;
    return message;
  }
};
function createBaseMsgUpdateParamsResponse() {
  return {};
}
export const MsgUpdateParamsResponse = {
  encode(_, writer = _m0.Writer.create()) {
    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 = createBaseMsgUpdateParamsResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(_) {
    return {};
  },
  toJSON(_) {
    const obj = {};
    return obj;
  },
  fromPartial(_) {
    const message = createBaseMsgUpdateParamsResponse();
    return message;
  }
};
function createBaseMsgModuleQuerySafe() {
  return {
    signer: "",
    requests: []
  };
}
export const MsgModuleQuerySafe = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.signer !== "") {
      writer.uint32(10).string(message.signer);
    }
    for (const v of message.requests) {
      QueryRequest.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 = createBaseMsgModuleQuerySafe();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.signer = reader.string();
          break;
        case 2:
          message.requests.push(QueryRequest.decode(reader, reader.uint32()));
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      signer: isSet(object.signer) ? String(object.signer) : "",
      requests: Array.isArray(object === null || object === void 0 ? void 0 : object.requests) ? object.requests.map(e => QueryRequest.fromJSON(e)) : []
    };
  },
  toJSON(message) {
    const obj = {};
    message.signer !== undefined && (obj.signer = message.signer);
    if (message.requests) {
      obj.requests = message.requests.map(e => e ? QueryRequest.toJSON(e) : undefined);
    } else {
      obj.requests = [];
    }
    return obj;
  },
  fromPartial(object) {
    var _object$signer2, _object$requests;
    const message = createBaseMsgModuleQuerySafe();
    message.signer = (_object$signer2 = object.signer) !== null && _object$signer2 !== void 0 ? _object$signer2 : "";
    message.requests = ((_object$requests = object.requests) === null || _object$requests === void 0 ? void 0 : _object$requests.map(e => QueryRequest.fromPartial(e))) || [];
    return message;
  }
};
function createBaseMsgModuleQuerySafeResponse() {
  return {
    height: Long.UZERO,
    responses: []
  };
}
export const MsgModuleQuerySafeResponse = {
  encode(message, writer = _m0.Writer.create()) {
    if (!message.height.isZero()) {
      writer.uint32(8).uint64(message.height);
    }
    for (const v of message.responses) {
      writer.uint32(18).bytes(v);
    }
    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 = createBaseMsgModuleQuerySafeResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.height = reader.uint64();
          break;
        case 2:
          message.responses.push(reader.bytes());
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      height: isSet(object.height) ? Long.fromValue(object.height) : Long.UZERO,
      responses: Array.isArray(object === null || object === void 0 ? void 0 : object.responses) ? object.responses.map(e => bytesFromBase64(e)) : []
    };
  },
  toJSON(message) {
    const obj = {};
    message.height !== undefined && (obj.height = (message.height || Long.UZERO).toString());
    if (message.responses) {
      obj.responses = message.responses.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array()));
    } else {
      obj.responses = [];
    }
    return obj;
  },
  fromPartial(object) {
    var _object$responses;
    const message = createBaseMsgModuleQuerySafeResponse();
    message.height = object.height !== undefined && object.height !== null ? Long.fromValue(object.height) : Long.UZERO;
    message.responses = ((_object$responses = object.responses) === null || _object$responses === void 0 ? void 0 : _object$responses.map(e => e)) || [];
    return message;
  }
};