text: /* eslint-disable */
  import { Reader, util, configure, Writer } from 'protobufjs/minimal';
  import * as Long from 'long';
  import { Comment } from '../blog/comment';
  import { PageRequest, PageResponse } from '../cosmos/base/query/v1beta1/pagination';
  import { Post } from '../blog/post';
  export const protobufPackage = 'example.blog.blog';
  const baseQueryGetCommentRequest = { id: 0 };
  export const QueryGetCommentRequest = {
      encode(message, writer = Writer.create()) {
          if (message.id !== 0) {
              writer.uint32(8).uint64(message.id);
          }
          return writer;
      },
      decode(input, length) {
          const reader = input instanceof Uint8Array ? new Reader(input) : input;
          let end = length === undefined ? reader.len : reader.pos + length;
          const message = { ...baseQueryGetCommentRequest };
          while (reader.pos < end) {
              const tag = reader.uint32();
              switch (tag >>> 3) {
                  case 1:
                      message.id = longToNumber(reader.uint64());
                      break;
                  default:
                      reader.skipType(tag & 7);
                      break;
              }
          }
          return message;
      },
      fromJSON(object) {
          const message = { ...baseQueryGetCommentRequest };
          if (object.id !== undefined && object.id !== null) {
              message.id = Number(object.id);
          }
          else {
              message.id = 0;
          }
          return message;
      },
      toJSON(message) {
          const obj = {};
          message.id !== undefined && (obj.id = message.id);
          return obj;
      },
      fromPartial(object) {
          const message = { ...baseQueryGetCommentRequest };
          if (object.id !== undefined && object.id !== null) {
              message.id = object.id;
          }
          else {
              message.id = 0;
          }
          return message;
      }
  };
  const baseQueryGetCommentResponse = {};
  export const QueryGetCommentResponse = {
      encode(message, writer = Writer.create()) {
          if (message.Comment !== undefined) {
              Comment.encode(message.Comment, writer.uint32(10).fork()).ldelim();
          }
          return writer;
      },
      decode(input, length) {
          const reader = input instanceof Uint8Array ? new Reader(input) : input;
          let end = length === undefined ? reader.len : reader.pos + length;
          const message = { ...baseQueryGetCommentResponse };
          while (reader.pos < end) {
              const tag = reader.uint32();
              switch (tag >>> 3) {
                  case 1:
                      message.Comment = Comment.decode(reader, reader.uint32());
                      break;
                  default:
                      reader.skipType(tag & 7);
                      break;
              }
          }
          return message;
      },
      fromJSON(object) {
          const message = { ...baseQueryGetCommentResponse };
          if (object.Comment !== undefined && object.Comment !== null) {
              message.Comment = Comment.fromJSON(object.Comment);
          }
          else {
              message.Comment = undefined;
          }
          return message;
      },
      toJSON(message) {
          const obj = {};
          message.Comment !== undefined && (obj.Comment = message.Comment ? Comment.toJSON(message.Comment) : undefined);
          return obj;
      },
      fromPartial(object) {
          const message = { ...baseQueryGetCommentResponse };
          if (object.Comment !== undefined && object.Comment !== null) {
              message.Comment = Comment.fromPartial(object.Comment);
          }
          else {
              message.Comment = undefined;
          }
          return message;
      }
  };
  const baseQueryAllCommentRequest = {};
  export const QueryAllCommentRequest = {
      encode(message, writer = Writer.create()) {
          if (message.pagination !== undefined) {
              PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim();
          }
          return writer;
      },
      decode(input, length) {
          const reader = input instanceof Uint8Array ? new Reader(input) : input;
          let end = length === undefined ? reader.len : reader.pos + length;
          const message = { ...baseQueryAllCommentRequest };
          while (reader.pos < end) {
              const tag = reader.uint32();
              switch (tag >>> 3) {
                  case 1:
                      message.pagination = PageRequest.decode(reader, reader.uint32());
                      break;
                  default:
                      reader.skipType(tag & 7);
                      break;
              }
          }
          return message;
      },
      fromJSON(object) {
          const message = { ...baseQueryAllCommentRequest };
          if (object.pagination !== undefined && object.pagination !== null) {
              message.pagination = PageRequest.fromJSON(object.pagination);
          }
          else {
              message.pagination = undefined;
          }
          return message;
      },
      toJSON(message) {
          const obj = {};
          message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined);
          return obj;
      },
      fromPartial(object) {
          const message = { ...baseQueryAllCommentRequest };
          if (object.pagination !== undefined && object.pagination !== null) {
              message.pagination = PageRequest.fromPartial(object.pagination);
          }
          else {
              message.pagination = undefined;
          }
          return message;
      }
  };
  const baseQueryAllCommentResponse = {};
  export const QueryAllCommentResponse = {
      encode(message, writer = Writer.create()) {
          for (const v of message.Comment) {
              Comment.encode(v, writer.uint32(10).fork()).ldelim();
          }
          if (message.pagination !== undefined) {
              PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim();
          }
          return writer;
      },
      decode(input, length) {
          const reader = input instanceof Uint8Array ? new Reader(input) : input;
          let end = length === undefined ? reader.len : reader.pos + length;
          const message = { ...baseQueryAllCommentResponse };
          message.Comment = [];
          while (reader.pos < end) {
              const tag = reader.uint32();
              switch (tag >>> 3) {
                  case 1:
                      message.Comment.push(Comment.decode(reader, reader.uint32()));
                      break;
                  case 2:
                      message.pagination = PageResponse.decode(reader, reader.uint32());
                      break;
                  default:
                      reader.skipType(tag & 7);
                      break;
              }
          }
          return message;
      },
      fromJSON(object) {
          const message = { ...baseQueryAllCommentResponse };
          message.Comment = [];
          if (object.Comment !== undefined && object.Comment !== null) {
              for (const e of object.Comment) {
                  message.Comment.push(Comment.fromJSON(e));
              }
          }
          if (object.pagination !== undefined && object.pagination !== null) {
              message.pagination = PageResponse.fromJSON(object.pagination);
          }
          else {
              message.pagination = undefined;
          }
          return message;
      },
      toJSON(message) {
          const obj = {};
          if (message.Comment) {
              obj.Comment = message.Comment.map((e) => (e ? Comment.toJSON(e) : undefined));
          }
          else {
              obj.Comment = [];
          }
          message.pagination !== undefined && (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined);
          return obj;
      },
      fromPartial(object) {
          const message = { ...baseQueryAllCommentResponse };
          message.Comment = [];
          if (object.Comment !== undefined && object.Comment !== null) {
              for (const e of object.Comment) {
                  message.Comment.push(Comment.fromPartial(e));
              }
          }
          if (object.pagination !== undefined && object.pagination !== null) {
              message.pagination = PageResponse.fromPartial(object.pagination);
          }
          else {
              message.pagination = undefined;
          }
          return message;
      }
  };
  const baseQueryGetPostRequest = { id: '' };
  export const QueryGetPostRequest = {
      encode(message, writer = Writer.create()) {
          if (message.id !== '') {
              writer.uint32(10).string(message.id);
          }
          return writer;
      },
      decode(input, length) {
          const reader = input instanceof Uint8Array ? new Reader(input) : input;
          let end = length === undefined ? reader.len : reader.pos + length;
          const message = { ...baseQueryGetPostRequest };
          while (reader.pos < end) {
              const tag = reader.uint32();
              switch (tag >>> 3) {
                  case 1:
                      message.id = reader.string();
                      break;
                  default:
                      reader.skipType(tag & 7);
                      break;
              }
          }
          return message;
      },
      fromJSON(object) {
          const message = { ...baseQueryGetPostRequest };
          if (object.id !== undefined && object.id !== null) {
              message.id = String(object.id);
          }
          else {
              message.id = '';
          }
          return message;
      },
      toJSON(message) {
          const obj = {};
          message.id !== undefined && (obj.id = message.id);
          return obj;
      },
      fromPartial(object) {
          const message = { ...baseQueryGetPostRequest };
          if (object.id !== undefined && object.id !== null) {
              message.id = object.id;
          }
          else {
              message.id = '';
          }
          return message;
      }
  };
  const baseQueryGetPostResponse = {};
  export const QueryGetPostResponse = {
      encode(message, writer = Writer.create()) {
          if (message.Post !== undefined) {
              Post.encode(message.Post, writer.uint32(10).fork()).ldelim();
          }
          return writer;
      },
      decode(input, length) {
          const reader = input instanceof Uint8Array ? new Reader(input) : input;
          let end = length === undefined ? reader.len : reader.pos + length;
          const message = { ...baseQueryGetPostResponse };
          while (reader.pos < end) {
              const tag = reader.uint32();
              switch (tag >>> 3) {
                  case 1:
                      message.Post = Post.decode(reader, reader.uint32());
                      break;
                  default:
                      reader.skipType(tag & 7);
                      break;
              }
          }
          return message;
      },
      fromJSON(object) {
          const message = { ...baseQueryGetPostResponse };
          if (object.Post !== undefined && object.Post !== null) {
              message.Post = Post.fromJSON(object.Post);
          }
          else {
              message.Post = undefined;
          }
          return message;
      },
      toJSON(message) {
          const obj = {};
          message.Post !== undefined && (obj.Post = message.Post ? Post.toJSON(message.Post) : undefined);
          return obj;
      },
      fromPartial(object) {
          const message = { ...baseQueryGetPostResponse };
          if (object.Post !== undefined && object.Post !== null) {
              message.Post = Post.fromPartial(object.Post);
          }
          else {
              message.Post = undefined;
          }
          return message;
      }
  };
  const baseQueryAllPostRequest = {};
  export const QueryAllPostRequest = {
      encode(message, writer = Writer.create()) {
          if (message.pagination !== undefined) {
              PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim();
          }
          return writer;
      },
      decode(input, length) {
          const reader = input instanceof Uint8Array ? new Reader(input) : input;
          let end = length === undefined ? reader.len : reader.pos + length;
          const message = { ...baseQueryAllPostRequest };
          while (reader.pos < end) {
              const tag = reader.uint32();
              switch (tag >>> 3) {
                  case 1:
                      message.pagination = PageRequest.decode(reader, reader.uint32());
                      break;
                  default:
                      reader.skipType(tag & 7);
                      break;
              }
          }
          return message;
      },
      fromJSON(object) {
          const message = { ...baseQueryAllPostRequest };
          if (object.pagination !== undefined && object.pagination !== null) {
              message.pagination = PageRequest.fromJSON(object.pagination);
          }
          else {
              message.pagination = undefined;
          }
          return message;
      },
      toJSON(message) {
          const obj = {};
          message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined);
          return obj;
      },
      fromPartial(object) {
          const message = { ...baseQueryAllPostRequest };
          if (object.pagination !== undefined && object.pagination !== null) {
              message.pagination = PageRequest.fromPartial(object.pagination);
          }
          else {
              message.pagination = undefined;
          }
          return message;
      }
  };
  const baseQueryAllPostResponse = {};
  export const QueryAllPostResponse = {
      encode(message, writer = Writer.create()) {
          for (const v of message.Post) {
              Post.encode(v, writer.uint32(10).fork()).ldelim();
          }
          if (message.pagination !== undefined) {
              PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim();
          }
          return writer;
      },
      decode(input, length) {
          const reader = input instanceof Uint8Array ? new Reader(input) : input;
          let end = length === undefined ? reader.len : reader.pos + length;
          const message = { ...baseQueryAllPostResponse };
          message.Post = [];
          while (reader.pos < end) {
              const tag = reader.uint32();
              switch (tag >>> 3) {
                  case 1:
                      message.Post.push(Post.decode(reader, reader.uint32()));
                      break;
                  case 2:
                      message.pagination = PageResponse.decode(reader, reader.uint32());
                      break;
                  default:
                      reader.skipType(tag & 7);
                      break;
              }
          }
          return message;
      },
      fromJSON(object) {
          const message = { ...baseQueryAllPostResponse };
          message.Post = [];
          if (object.Post !== undefined && object.Post !== null) {
              for (const e of object.Post) {
                  message.Post.push(Post.fromJSON(e));
              }
          }
          if (object.pagination !== undefined && object.pagination !== null) {
              message.pagination = PageResponse.fromJSON(object.pagination);
          }
          else {
              message.pagination = undefined;
          }
          return message;
      },
      toJSON(message) {
          const obj = {};
          if (message.Post) {
              obj.Post = message.Post.map((e) => (e ? Post.toJSON(e) : undefined));
          }
          else {
              obj.Post = [];
          }
          message.pagination !== undefined && (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined);
          return obj;
      },
      fromPartial(object) {
          const message = { ...baseQueryAllPostResponse };
          message.Post = [];
          if (object.Post !== undefined && object.Post !== null) {
              for (const e of object.Post) {
                  message.Post.push(Post.fromPartial(e));
              }
          }
          if (object.pagination !== undefined && object.pagination !== null) {
              message.pagination = PageResponse.fromPartial(object.pagination);
          }
          else {
              message.pagination = undefined;
          }
          return message;
      }
  };
  export class QueryClientImpl {
      constructor(rpc) {
          this.rpc = rpc;
      }
      Comment(request) {
          const data = QueryGetCommentRequest.encode(request).finish();
          const promise = this.rpc.request('example.blog.blog.Query', 'Comment', data);
          return promise.then((data) => QueryGetCommentResponse.decode(new Reader(data)));
      }
      CommentAll(request) {
          const data = QueryAllCommentRequest.encode(request).finish();
          const promise = this.rpc.request('example.blog.blog.Query', 'CommentAll', data);
          return promise.then((data) => QueryAllCommentResponse.decode(new Reader(data)));
      }
      Post(request) {
          const data = QueryGetPostRequest.encode(request).finish();
          const promise = this.rpc.request('example.blog.blog.Query', 'Post', data);
          return promise.then((data) => QueryGetPostResponse.decode(new Reader(data)));
      }
      PostAll(request) {
          const data = QueryAllPostRequest.encode(request).finish();
          const promise = this.rpc.request('example.blog.blog.Query', 'PostAll', data);
          return promise.then((data) => QueryAllPostResponse.decode(new Reader(data)));
      }
  }
  var globalThis = (() => {
      if (typeof globalThis !== 'undefined')
          return globalThis;
      if (typeof self !== 'undefined')
          return self;
      if (typeof window !== 'undefined')
          return window;
      if (typeof global !== 'undefined')
          return global;
      throw 'Unable to locate global object';
  })();
  function longToNumber(long) {
      if (long.gt(Number.MAX_SAFE_INTEGER)) {
          throw new globalThis.Error('Value is larger than Number.MAX_SAFE_INTEGER');
      }
      return long.toNumber();
  }
  if (util.Long !== Long) {
      util.Long = Long;
      configure();
  }
  