// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
//   protoc-gen-ts_proto  v2.11.2
//   protoc               unknown
// source: ignite/planet/mars/mars.proto

/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import { PageRequest, PageResponse } from "../../../cosmos/base/query/v1beta1/pagination";

export const protobufPackage = "ignite.planet.mars";

export interface MsgMyMessageRequest {
  mytypefield: string;
}

export interface MsgMyMessageResponse {
  mytypefield: string;
}

export interface MsgBarRequest {
  mytypefield: string;
}

export interface MsgBarResponse {
  mytypefield: string;
}

export interface QuerySimpleRequest {
}

export interface QuerySimpleResponse {
  bar: string;
}

export interface QuerySimpleParamsRequest {
  mytypefield: string;
}

export interface QuerySimpleParamsResponse {
  bar: string;
}

export interface QueryWithPaginationRequest {
  mytypefield: string;
  pagination: PageRequest | undefined;
}

export interface QueryWithPaginationResponse {
  pagination: PageResponse | undefined;
}

export interface QueryWithQueryParamsRequest {
  mytypefield: string;
  queryParam: string;
  mybool: boolean;
  myrepeatedbool: boolean[];
}

export interface QueryWithQueryParamsResponse {
  bar: string;
}

export interface QueryWithQueryParamsWithPaginationRequest {
  mytypefield: string;
  queryParam: string;
  pagination: PageRequest | undefined;
}

export interface QueryWithQueryParamsWithPaginationResponse {
  bar: string;
  pagination: PageResponse | undefined;
}

export interface AnotherType {
  mytypefield: string;
}

function createBaseMsgMyMessageRequest(): MsgMyMessageRequest {
  return { mytypefield: "" };
}

export const MsgMyMessageRequest: MessageFns<MsgMyMessageRequest> = {
  encode(message: MsgMyMessageRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.mytypefield !== "") {
      writer.uint32(10).string(message.mytypefield);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): MsgMyMessageRequest {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseMsgMyMessageRequest();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.mytypefield = reader.string();
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): MsgMyMessageRequest {
    return { mytypefield: isSet(object.mytypefield) ? globalThis.String(object.mytypefield) : "" };
  },

  toJSON(message: MsgMyMessageRequest): unknown {
    const obj: any = {};
    if (message.mytypefield !== "") {
      obj.mytypefield = message.mytypefield;
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<MsgMyMessageRequest>, I>>(base?: I): MsgMyMessageRequest {
    return MsgMyMessageRequest.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<MsgMyMessageRequest>, I>>(object: I): MsgMyMessageRequest {
    const message = createBaseMsgMyMessageRequest();
    message.mytypefield = object.mytypefield ?? "";
    return message;
  },
};

function createBaseMsgMyMessageResponse(): MsgMyMessageResponse {
  return { mytypefield: "" };
}

export const MsgMyMessageResponse: MessageFns<MsgMyMessageResponse> = {
  encode(message: MsgMyMessageResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.mytypefield !== "") {
      writer.uint32(10).string(message.mytypefield);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): MsgMyMessageResponse {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseMsgMyMessageResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.mytypefield = reader.string();
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): MsgMyMessageResponse {
    return { mytypefield: isSet(object.mytypefield) ? globalThis.String(object.mytypefield) : "" };
  },

  toJSON(message: MsgMyMessageResponse): unknown {
    const obj: any = {};
    if (message.mytypefield !== "") {
      obj.mytypefield = message.mytypefield;
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<MsgMyMessageResponse>, I>>(base?: I): MsgMyMessageResponse {
    return MsgMyMessageResponse.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<MsgMyMessageResponse>, I>>(object: I): MsgMyMessageResponse {
    const message = createBaseMsgMyMessageResponse();
    message.mytypefield = object.mytypefield ?? "";
    return message;
  },
};

function createBaseMsgBarRequest(): MsgBarRequest {
  return { mytypefield: "" };
}

export const MsgBarRequest: MessageFns<MsgBarRequest> = {
  encode(message: MsgBarRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.mytypefield !== "") {
      writer.uint32(10).string(message.mytypefield);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): MsgBarRequest {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseMsgBarRequest();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.mytypefield = reader.string();
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): MsgBarRequest {
    return { mytypefield: isSet(object.mytypefield) ? globalThis.String(object.mytypefield) : "" };
  },

  toJSON(message: MsgBarRequest): unknown {
    const obj: any = {};
    if (message.mytypefield !== "") {
      obj.mytypefield = message.mytypefield;
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<MsgBarRequest>, I>>(base?: I): MsgBarRequest {
    return MsgBarRequest.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<MsgBarRequest>, I>>(object: I): MsgBarRequest {
    const message = createBaseMsgBarRequest();
    message.mytypefield = object.mytypefield ?? "";
    return message;
  },
};

function createBaseMsgBarResponse(): MsgBarResponse {
  return { mytypefield: "" };
}

export const MsgBarResponse: MessageFns<MsgBarResponse> = {
  encode(message: MsgBarResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.mytypefield !== "") {
      writer.uint32(10).string(message.mytypefield);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): MsgBarResponse {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseMsgBarResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.mytypefield = reader.string();
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): MsgBarResponse {
    return { mytypefield: isSet(object.mytypefield) ? globalThis.String(object.mytypefield) : "" };
  },

  toJSON(message: MsgBarResponse): unknown {
    const obj: any = {};
    if (message.mytypefield !== "") {
      obj.mytypefield = message.mytypefield;
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<MsgBarResponse>, I>>(base?: I): MsgBarResponse {
    return MsgBarResponse.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<MsgBarResponse>, I>>(object: I): MsgBarResponse {
    const message = createBaseMsgBarResponse();
    message.mytypefield = object.mytypefield ?? "";
    return message;
  },
};

function createBaseQuerySimpleRequest(): QuerySimpleRequest {
  return {};
}

export const QuerySimpleRequest: MessageFns<QuerySimpleRequest> = {
  encode(_: QuerySimpleRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): QuerySimpleRequest {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseQuerySimpleRequest();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(_: any): QuerySimpleRequest {
    return {};
  },

  toJSON(_: QuerySimpleRequest): unknown {
    const obj: any = {};
    return obj;
  },

  create<I extends Exact<DeepPartial<QuerySimpleRequest>, I>>(base?: I): QuerySimpleRequest {
    return QuerySimpleRequest.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<QuerySimpleRequest>, I>>(_: I): QuerySimpleRequest {
    const message = createBaseQuerySimpleRequest();
    return message;
  },
};

function createBaseQuerySimpleResponse(): QuerySimpleResponse {
  return { bar: "" };
}

export const QuerySimpleResponse: MessageFns<QuerySimpleResponse> = {
  encode(message: QuerySimpleResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.bar !== "") {
      writer.uint32(10).string(message.bar);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): QuerySimpleResponse {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseQuerySimpleResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.bar = reader.string();
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): QuerySimpleResponse {
    return { bar: isSet(object.bar) ? globalThis.String(object.bar) : "" };
  },

  toJSON(message: QuerySimpleResponse): unknown {
    const obj: any = {};
    if (message.bar !== "") {
      obj.bar = message.bar;
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<QuerySimpleResponse>, I>>(base?: I): QuerySimpleResponse {
    return QuerySimpleResponse.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<QuerySimpleResponse>, I>>(object: I): QuerySimpleResponse {
    const message = createBaseQuerySimpleResponse();
    message.bar = object.bar ?? "";
    return message;
  },
};

function createBaseQuerySimpleParamsRequest(): QuerySimpleParamsRequest {
  return { mytypefield: "" };
}

export const QuerySimpleParamsRequest: MessageFns<QuerySimpleParamsRequest> = {
  encode(message: QuerySimpleParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.mytypefield !== "") {
      writer.uint32(10).string(message.mytypefield);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): QuerySimpleParamsRequest {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseQuerySimpleParamsRequest();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.mytypefield = reader.string();
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): QuerySimpleParamsRequest {
    return { mytypefield: isSet(object.mytypefield) ? globalThis.String(object.mytypefield) : "" };
  },

  toJSON(message: QuerySimpleParamsRequest): unknown {
    const obj: any = {};
    if (message.mytypefield !== "") {
      obj.mytypefield = message.mytypefield;
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<QuerySimpleParamsRequest>, I>>(base?: I): QuerySimpleParamsRequest {
    return QuerySimpleParamsRequest.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<QuerySimpleParamsRequest>, I>>(object: I): QuerySimpleParamsRequest {
    const message = createBaseQuerySimpleParamsRequest();
    message.mytypefield = object.mytypefield ?? "";
    return message;
  },
};

function createBaseQuerySimpleParamsResponse(): QuerySimpleParamsResponse {
  return { bar: "" };
}

export const QuerySimpleParamsResponse: MessageFns<QuerySimpleParamsResponse> = {
  encode(message: QuerySimpleParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.bar !== "") {
      writer.uint32(10).string(message.bar);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): QuerySimpleParamsResponse {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseQuerySimpleParamsResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.bar = reader.string();
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): QuerySimpleParamsResponse {
    return { bar: isSet(object.bar) ? globalThis.String(object.bar) : "" };
  },

  toJSON(message: QuerySimpleParamsResponse): unknown {
    const obj: any = {};
    if (message.bar !== "") {
      obj.bar = message.bar;
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<QuerySimpleParamsResponse>, I>>(base?: I): QuerySimpleParamsResponse {
    return QuerySimpleParamsResponse.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<QuerySimpleParamsResponse>, I>>(object: I): QuerySimpleParamsResponse {
    const message = createBaseQuerySimpleParamsResponse();
    message.bar = object.bar ?? "";
    return message;
  },
};

function createBaseQueryWithPaginationRequest(): QueryWithPaginationRequest {
  return { mytypefield: "", pagination: undefined };
}

export const QueryWithPaginationRequest: MessageFns<QueryWithPaginationRequest> = {
  encode(message: QueryWithPaginationRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.mytypefield !== "") {
      writer.uint32(10).string(message.mytypefield);
    }
    if (message.pagination !== undefined) {
      PageRequest.encode(message.pagination, writer.uint32(18).fork()).join();
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): QueryWithPaginationRequest {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseQueryWithPaginationRequest();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.mytypefield = reader.string();
          continue;
        }
        case 2: {
          if (tag !== 18) {
            break;
          }

          message.pagination = PageRequest.decode(reader, reader.uint32());
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): QueryWithPaginationRequest {
    return {
      mytypefield: isSet(object.mytypefield) ? globalThis.String(object.mytypefield) : "",
      pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined,
    };
  },

  toJSON(message: QueryWithPaginationRequest): unknown {
    const obj: any = {};
    if (message.mytypefield !== "") {
      obj.mytypefield = message.mytypefield;
    }
    if (message.pagination !== undefined) {
      obj.pagination = PageRequest.toJSON(message.pagination);
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<QueryWithPaginationRequest>, I>>(base?: I): QueryWithPaginationRequest {
    return QueryWithPaginationRequest.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<QueryWithPaginationRequest>, I>>(object: I): QueryWithPaginationRequest {
    const message = createBaseQueryWithPaginationRequest();
    message.mytypefield = object.mytypefield ?? "";
    message.pagination = (object.pagination !== undefined && object.pagination !== null)
      ? PageRequest.fromPartial(object.pagination)
      : undefined;
    return message;
  },
};

function createBaseQueryWithPaginationResponse(): QueryWithPaginationResponse {
  return { pagination: undefined };
}

export const QueryWithPaginationResponse: MessageFns<QueryWithPaginationResponse> = {
  encode(message: QueryWithPaginationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.pagination !== undefined) {
      PageResponse.encode(message.pagination, writer.uint32(10).fork()).join();
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): QueryWithPaginationResponse {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseQueryWithPaginationResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.pagination = PageResponse.decode(reader, reader.uint32());
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): QueryWithPaginationResponse {
    return { pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined };
  },

  toJSON(message: QueryWithPaginationResponse): unknown {
    const obj: any = {};
    if (message.pagination !== undefined) {
      obj.pagination = PageResponse.toJSON(message.pagination);
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<QueryWithPaginationResponse>, I>>(base?: I): QueryWithPaginationResponse {
    return QueryWithPaginationResponse.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<QueryWithPaginationResponse>, I>>(object: I): QueryWithPaginationResponse {
    const message = createBaseQueryWithPaginationResponse();
    message.pagination = (object.pagination !== undefined && object.pagination !== null)
      ? PageResponse.fromPartial(object.pagination)
      : undefined;
    return message;
  },
};

function createBaseQueryWithQueryParamsRequest(): QueryWithQueryParamsRequest {
  return { mytypefield: "", queryParam: "", mybool: false, myrepeatedbool: [] };
}

export const QueryWithQueryParamsRequest: MessageFns<QueryWithQueryParamsRequest> = {
  encode(message: QueryWithQueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.mytypefield !== "") {
      writer.uint32(10).string(message.mytypefield);
    }
    if (message.queryParam !== "") {
      writer.uint32(18).string(message.queryParam);
    }
    if (message.mybool !== false) {
      writer.uint32(24).bool(message.mybool);
    }
    writer.uint32(34).fork();
    for (const v of message.myrepeatedbool) {
      writer.bool(v);
    }
    writer.join();
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): QueryWithQueryParamsRequest {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseQueryWithQueryParamsRequest();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.mytypefield = reader.string();
          continue;
        }
        case 2: {
          if (tag !== 18) {
            break;
          }

          message.queryParam = reader.string();
          continue;
        }
        case 3: {
          if (tag !== 24) {
            break;
          }

          message.mybool = reader.bool();
          continue;
        }
        case 4: {
          if (tag === 32) {
            message.myrepeatedbool.push(reader.bool());

            continue;
          }

          if (tag === 34) {
            const end2 = reader.uint32() + reader.pos;
            while (reader.pos < end2) {
              message.myrepeatedbool.push(reader.bool());
            }

            continue;
          }

          break;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): QueryWithQueryParamsRequest {
    return {
      mytypefield: isSet(object.mytypefield) ? globalThis.String(object.mytypefield) : "",
      queryParam: isSet(object.queryParam)
        ? globalThis.String(object.queryParam)
        : isSet(object.query_param)
        ? globalThis.String(object.query_param)
        : "",
      mybool: isSet(object.mybool) ? globalThis.Boolean(object.mybool) : false,
      myrepeatedbool: globalThis.Array.isArray(object?.myrepeatedbool)
        ? object.myrepeatedbool.map((e: any) => globalThis.Boolean(e))
        : [],
    };
  },

  toJSON(message: QueryWithQueryParamsRequest): unknown {
    const obj: any = {};
    if (message.mytypefield !== "") {
      obj.mytypefield = message.mytypefield;
    }
    if (message.queryParam !== "") {
      obj.queryParam = message.queryParam;
    }
    if (message.mybool !== false) {
      obj.mybool = message.mybool;
    }
    if (message.myrepeatedbool?.length) {
      obj.myrepeatedbool = message.myrepeatedbool;
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<QueryWithQueryParamsRequest>, I>>(base?: I): QueryWithQueryParamsRequest {
    return QueryWithQueryParamsRequest.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<QueryWithQueryParamsRequest>, I>>(object: I): QueryWithQueryParamsRequest {
    const message = createBaseQueryWithQueryParamsRequest();
    message.mytypefield = object.mytypefield ?? "";
    message.queryParam = object.queryParam ?? "";
    message.mybool = object.mybool ?? false;
    message.myrepeatedbool = object.myrepeatedbool?.map((e) => e) || [];
    return message;
  },
};

function createBaseQueryWithQueryParamsResponse(): QueryWithQueryParamsResponse {
  return { bar: "" };
}

export const QueryWithQueryParamsResponse: MessageFns<QueryWithQueryParamsResponse> = {
  encode(message: QueryWithQueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.bar !== "") {
      writer.uint32(10).string(message.bar);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): QueryWithQueryParamsResponse {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseQueryWithQueryParamsResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.bar = reader.string();
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): QueryWithQueryParamsResponse {
    return { bar: isSet(object.bar) ? globalThis.String(object.bar) : "" };
  },

  toJSON(message: QueryWithQueryParamsResponse): unknown {
    const obj: any = {};
    if (message.bar !== "") {
      obj.bar = message.bar;
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<QueryWithQueryParamsResponse>, I>>(base?: I): QueryWithQueryParamsResponse {
    return QueryWithQueryParamsResponse.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<QueryWithQueryParamsResponse>, I>>(object: I): QueryWithQueryParamsResponse {
    const message = createBaseQueryWithQueryParamsResponse();
    message.bar = object.bar ?? "";
    return message;
  },
};

function createBaseQueryWithQueryParamsWithPaginationRequest(): QueryWithQueryParamsWithPaginationRequest {
  return { mytypefield: "", queryParam: "", pagination: undefined };
}

export const QueryWithQueryParamsWithPaginationRequest: MessageFns<QueryWithQueryParamsWithPaginationRequest> = {
  encode(message: QueryWithQueryParamsWithPaginationRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.mytypefield !== "") {
      writer.uint32(10).string(message.mytypefield);
    }
    if (message.queryParam !== "") {
      writer.uint32(18).string(message.queryParam);
    }
    if (message.pagination !== undefined) {
      PageRequest.encode(message.pagination, writer.uint32(26).fork()).join();
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): QueryWithQueryParamsWithPaginationRequest {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseQueryWithQueryParamsWithPaginationRequest();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.mytypefield = reader.string();
          continue;
        }
        case 2: {
          if (tag !== 18) {
            break;
          }

          message.queryParam = reader.string();
          continue;
        }
        case 3: {
          if (tag !== 26) {
            break;
          }

          message.pagination = PageRequest.decode(reader, reader.uint32());
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): QueryWithQueryParamsWithPaginationRequest {
    return {
      mytypefield: isSet(object.mytypefield) ? globalThis.String(object.mytypefield) : "",
      queryParam: isSet(object.queryParam)
        ? globalThis.String(object.queryParam)
        : isSet(object.query_param)
        ? globalThis.String(object.query_param)
        : "",
      pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined,
    };
  },

  toJSON(message: QueryWithQueryParamsWithPaginationRequest): unknown {
    const obj: any = {};
    if (message.mytypefield !== "") {
      obj.mytypefield = message.mytypefield;
    }
    if (message.queryParam !== "") {
      obj.queryParam = message.queryParam;
    }
    if (message.pagination !== undefined) {
      obj.pagination = PageRequest.toJSON(message.pagination);
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<QueryWithQueryParamsWithPaginationRequest>, I>>(
    base?: I,
  ): QueryWithQueryParamsWithPaginationRequest {
    return QueryWithQueryParamsWithPaginationRequest.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<QueryWithQueryParamsWithPaginationRequest>, I>>(
    object: I,
  ): QueryWithQueryParamsWithPaginationRequest {
    const message = createBaseQueryWithQueryParamsWithPaginationRequest();
    message.mytypefield = object.mytypefield ?? "";
    message.queryParam = object.queryParam ?? "";
    message.pagination = (object.pagination !== undefined && object.pagination !== null)
      ? PageRequest.fromPartial(object.pagination)
      : undefined;
    return message;
  },
};

function createBaseQueryWithQueryParamsWithPaginationResponse(): QueryWithQueryParamsWithPaginationResponse {
  return { bar: "", pagination: undefined };
}

export const QueryWithQueryParamsWithPaginationResponse: MessageFns<QueryWithQueryParamsWithPaginationResponse> = {
  encode(message: QueryWithQueryParamsWithPaginationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.bar !== "") {
      writer.uint32(10).string(message.bar);
    }
    if (message.pagination !== undefined) {
      PageResponse.encode(message.pagination, writer.uint32(18).fork()).join();
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): QueryWithQueryParamsWithPaginationResponse {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseQueryWithQueryParamsWithPaginationResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.bar = reader.string();
          continue;
        }
        case 2: {
          if (tag !== 18) {
            break;
          }

          message.pagination = PageResponse.decode(reader, reader.uint32());
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): QueryWithQueryParamsWithPaginationResponse {
    return {
      bar: isSet(object.bar) ? globalThis.String(object.bar) : "",
      pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined,
    };
  },

  toJSON(message: QueryWithQueryParamsWithPaginationResponse): unknown {
    const obj: any = {};
    if (message.bar !== "") {
      obj.bar = message.bar;
    }
    if (message.pagination !== undefined) {
      obj.pagination = PageResponse.toJSON(message.pagination);
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<QueryWithQueryParamsWithPaginationResponse>, I>>(
    base?: I,
  ): QueryWithQueryParamsWithPaginationResponse {
    return QueryWithQueryParamsWithPaginationResponse.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<QueryWithQueryParamsWithPaginationResponse>, I>>(
    object: I,
  ): QueryWithQueryParamsWithPaginationResponse {
    const message = createBaseQueryWithQueryParamsWithPaginationResponse();
    message.bar = object.bar ?? "";
    message.pagination = (object.pagination !== undefined && object.pagination !== null)
      ? PageResponse.fromPartial(object.pagination)
      : undefined;
    return message;
  },
};

function createBaseAnotherType(): AnotherType {
  return { mytypefield: "" };
}

export const AnotherType: MessageFns<AnotherType> = {
  encode(message: AnotherType, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.mytypefield !== "") {
      writer.uint32(10).string(message.mytypefield);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): AnotherType {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseAnotherType();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.mytypefield = reader.string();
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): AnotherType {
    return { mytypefield: isSet(object.mytypefield) ? globalThis.String(object.mytypefield) : "" };
  },

  toJSON(message: AnotherType): unknown {
    const obj: any = {};
    if (message.mytypefield !== "") {
      obj.mytypefield = message.mytypefield;
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<AnotherType>, I>>(base?: I): AnotherType {
    return AnotherType.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<AnotherType>, I>>(object: I): AnotherType {
    const message = createBaseAnotherType();
    message.mytypefield = object.mytypefield ?? "";
    return message;
  },
};

export interface Msg {
  MyMessage(request: MsgMyMessageRequest): Promise<MsgMyMessageResponse>;
  Bar(request: MsgBarRequest): Promise<MsgBarResponse>;
}

export const MsgServiceName = "ignite.planet.mars.Msg";
export class MsgClientImpl implements Msg {
  private readonly rpc: Rpc;
  private readonly service: string;
  constructor(rpc: Rpc, opts?: { service?: string }) {
    this.service = opts?.service || MsgServiceName;
    this.rpc = rpc;
    this.MyMessage = this.MyMessage.bind(this);
    this.Bar = this.Bar.bind(this);
  }
  MyMessage(request: MsgMyMessageRequest): Promise<MsgMyMessageResponse> {
    const data = MsgMyMessageRequest.encode(request).finish();
    const promise = this.rpc.request(this.service, "MyMessage", data);
    return promise.then((data) => MsgMyMessageResponse.decode(new BinaryReader(data)));
  }

  Bar(request: MsgBarRequest): Promise<MsgBarResponse> {
    const data = MsgBarRequest.encode(request).finish();
    const promise = this.rpc.request(this.service, "Bar", data);
    return promise.then((data) => MsgBarResponse.decode(new BinaryReader(data)));
  }
}

export interface Query {
  QuerySimple(request: QuerySimpleRequest): Promise<QuerySimpleResponse>;
  QuerySimpleParams(request: QuerySimpleParamsRequest): Promise<QuerySimpleParamsResponse>;
  QueryParamsWithPagination(request: QueryWithPaginationRequest): Promise<QueryWithPaginationResponse>;
  QueryWithQueryParams(request: QueryWithQueryParamsRequest): Promise<QueryWithQueryParamsResponse>;
  QueryWithQueryParamsWithPagination(
    request: QueryWithQueryParamsWithPaginationRequest,
  ): Promise<QueryWithQueryParamsWithPaginationResponse>;
}

export const QueryServiceName = "ignite.planet.mars.Query";
export class QueryClientImpl implements Query {
  private readonly rpc: Rpc;
  private readonly service: string;
  constructor(rpc: Rpc, opts?: { service?: string }) {
    this.service = opts?.service || QueryServiceName;
    this.rpc = rpc;
    this.QuerySimple = this.QuerySimple.bind(this);
    this.QuerySimpleParams = this.QuerySimpleParams.bind(this);
    this.QueryParamsWithPagination = this.QueryParamsWithPagination.bind(this);
    this.QueryWithQueryParams = this.QueryWithQueryParams.bind(this);
    this.QueryWithQueryParamsWithPagination = this.QueryWithQueryParamsWithPagination.bind(this);
  }
  QuerySimple(request: QuerySimpleRequest): Promise<QuerySimpleResponse> {
    const data = QuerySimpleRequest.encode(request).finish();
    const promise = this.rpc.request(this.service, "QuerySimple", data);
    return promise.then((data) => QuerySimpleResponse.decode(new BinaryReader(data)));
  }

  QuerySimpleParams(request: QuerySimpleParamsRequest): Promise<QuerySimpleParamsResponse> {
    const data = QuerySimpleParamsRequest.encode(request).finish();
    const promise = this.rpc.request(this.service, "QuerySimpleParams", data);
    return promise.then((data) => QuerySimpleParamsResponse.decode(new BinaryReader(data)));
  }

  QueryParamsWithPagination(request: QueryWithPaginationRequest): Promise<QueryWithPaginationResponse> {
    const data = QueryWithPaginationRequest.encode(request).finish();
    const promise = this.rpc.request(this.service, "QueryParamsWithPagination", data);
    return promise.then((data) => QueryWithPaginationResponse.decode(new BinaryReader(data)));
  }

  QueryWithQueryParams(request: QueryWithQueryParamsRequest): Promise<QueryWithQueryParamsResponse> {
    const data = QueryWithQueryParamsRequest.encode(request).finish();
    const promise = this.rpc.request(this.service, "QueryWithQueryParams", data);
    return promise.then((data) => QueryWithQueryParamsResponse.decode(new BinaryReader(data)));
  }

  QueryWithQueryParamsWithPagination(
    request: QueryWithQueryParamsWithPaginationRequest,
  ): Promise<QueryWithQueryParamsWithPaginationResponse> {
    const data = QueryWithQueryParamsWithPaginationRequest.encode(request).finish();
    const promise = this.rpc.request(this.service, "QueryWithQueryParamsWithPagination", data);
    return promise.then((data) => QueryWithQueryParamsWithPaginationResponse.decode(new BinaryReader(data)));
  }
}

interface Rpc {
  request(service: string, method: string, data: Uint8Array): Promise<Uint8Array>;
}

type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;

export type DeepPartial<T> = T extends Builtin ? T
  : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
  : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
  : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
  : Partial<T>;

type KeysOfUnion<T> = T extends T ? keyof T : never;
export type Exact<P, I extends P> = P extends Builtin ? P
  : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };

function isSet(value: any): boolean {
  return value !== null && value !== undefined;
}

export interface MessageFns<T> {
  encode(message: T, writer?: BinaryWriter): BinaryWriter;
  decode(input: BinaryReader | Uint8Array, length?: number): T;
  fromJSON(object: any): T;
  toJSON(message: T): unknown;
  create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
  fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
}
