//@ts-nocheck
import { PageRequest, PageResponse } from "../../../cosmos/base/query/v1beta1/pagination";
import { Params, Token, TokenData } from "./token";
import * as _m0 from "protobufjs/minimal";
import { isSet } from "../../../helpers";
function createBaseQueryParamsRequest() {
  return {};
}
export const QueryParamsRequest = {
  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 = createBaseQueryParamsRequest();
    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 = createBaseQueryParamsRequest();
    return message;
  }
};
function createBaseQueryParamsResponse() {
  return {
    params: undefined
  };
}
export const QueryParamsResponse = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.params !== undefined) {
      Params.encode(message.params, writer.uint32(10).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 = createBaseQueryParamsResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.params = Params.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
    };
  },
  toJSON(message) {
    const obj = {};
    message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined);
    return obj;
  },
  fromPartial(object) {
    const message = createBaseQueryParamsResponse();
    message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined;
    return message;
  }
};
function createBaseQueryTokenListRequest() {
  return {
    pagination: undefined,
    minter: ""
  };
}
export const QueryTokenListRequest = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.pagination !== undefined) {
      PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim();
    }
    if (message.minter !== "") {
      writer.uint32(18).string(message.minter);
    }
    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 = createBaseQueryTokenListRequest();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.pagination = PageRequest.decode(reader, reader.uint32());
          break;
        case 2:
          message.minter = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined,
      minter: isSet(object.minter) ? String(object.minter) : ""
    };
  },
  toJSON(message) {
    const obj = {};
    message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined);
    message.minter !== undefined && (obj.minter = message.minter);
    return obj;
  },
  fromPartial(object) {
    var _object$minter;
    const message = createBaseQueryTokenListRequest();
    message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined;
    message.minter = (_object$minter = object.minter) !== null && _object$minter !== void 0 ? _object$minter : "";
    return message;
  }
};
function createBaseQueryTokenListResponse() {
  return {
    pagination: undefined,
    tokenDocs: []
  };
}
export const QueryTokenListResponse = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.pagination !== undefined) {
      PageResponse.encode(message.pagination, writer.uint32(10).fork()).ldelim();
    }
    for (const v of message.tokenDocs) {
      Token.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 = createBaseQueryTokenListResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.pagination = PageResponse.decode(reader, reader.uint32());
          break;
        case 2:
          message.tokenDocs.push(Token.decode(reader, reader.uint32()));
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined,
      tokenDocs: Array.isArray(object === null || object === void 0 ? void 0 : object.tokenDocs) ? object.tokenDocs.map(e => Token.fromJSON(e)) : []
    };
  },
  toJSON(message) {
    const obj = {};
    message.pagination !== undefined && (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined);
    if (message.tokenDocs) {
      obj.tokenDocs = message.tokenDocs.map(e => e ? Token.toJSON(e) : undefined);
    } else {
      obj.tokenDocs = [];
    }
    return obj;
  },
  fromPartial(object) {
    var _object$tokenDocs;
    const message = createBaseQueryTokenListResponse();
    message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined;
    message.tokenDocs = ((_object$tokenDocs = object.tokenDocs) === null || _object$tokenDocs === void 0 ? void 0 : _object$tokenDocs.map(e => Token.fromPartial(e))) || [];
    return message;
  }
};
function createBaseQueryTokenDocRequest() {
  return {
    minter: "",
    contractAddress: ""
  };
}
export const QueryTokenDocRequest = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.minter !== "") {
      writer.uint32(10).string(message.minter);
    }
    if (message.contractAddress !== "") {
      writer.uint32(18).string(message.contractAddress);
    }
    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 = createBaseQueryTokenDocRequest();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.minter = reader.string();
          break;
        case 2:
          message.contractAddress = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      minter: isSet(object.minter) ? String(object.minter) : "",
      contractAddress: isSet(object.contractAddress) ? String(object.contractAddress) : ""
    };
  },
  toJSON(message) {
    const obj = {};
    message.minter !== undefined && (obj.minter = message.minter);
    message.contractAddress !== undefined && (obj.contractAddress = message.contractAddress);
    return obj;
  },
  fromPartial(object) {
    var _object$minter2, _object$contractAddre;
    const message = createBaseQueryTokenDocRequest();
    message.minter = (_object$minter2 = object.minter) !== null && _object$minter2 !== void 0 ? _object$minter2 : "";
    message.contractAddress = (_object$contractAddre = object.contractAddress) !== null && _object$contractAddre !== void 0 ? _object$contractAddre : "";
    return message;
  }
};
function createBaseQueryTokenDocResponse() {
  return {
    tokenDoc: undefined
  };
}
export const QueryTokenDocResponse = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.tokenDoc !== undefined) {
      Token.encode(message.tokenDoc, writer.uint32(10).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 = createBaseQueryTokenDocResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.tokenDoc = Token.decode(reader, reader.uint32());
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      tokenDoc: isSet(object.tokenDoc) ? Token.fromJSON(object.tokenDoc) : undefined
    };
  },
  toJSON(message) {
    const obj = {};
    message.tokenDoc !== undefined && (obj.tokenDoc = message.tokenDoc ? Token.toJSON(message.tokenDoc) : undefined);
    return obj;
  },
  fromPartial(object) {
    const message = createBaseQueryTokenDocResponse();
    message.tokenDoc = object.tokenDoc !== undefined && object.tokenDoc !== null ? Token.fromPartial(object.tokenDoc) : undefined;
    return message;
  }
};
function createBaseQueryTokenMetadataRequest() {
  return {
    id: ""
  };
}
export const QueryTokenMetadataRequest = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.id !== "") {
      writer.uint32(10).string(message.id);
    }
    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 = createBaseQueryTokenMetadataRequest();
    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) {
    return {
      id: isSet(object.id) ? String(object.id) : ""
    };
  },
  toJSON(message) {
    const obj = {};
    message.id !== undefined && (obj.id = message.id);
    return obj;
  },
  fromPartial(object) {
    var _object$id;
    const message = createBaseQueryTokenMetadataRequest();
    message.id = (_object$id = object.id) !== null && _object$id !== void 0 ? _object$id : "";
    return message;
  }
};
function createBaseQueryTokenMetadataResponse() {
  return {
    name: "",
    description: "",
    decimals: "",
    image: "",
    index: "",
    properties: undefined
  };
}
export const QueryTokenMetadataResponse = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.name !== "") {
      writer.uint32(10).string(message.name);
    }
    if (message.description !== "") {
      writer.uint32(18).string(message.description);
    }
    if (message.decimals !== "") {
      writer.uint32(26).string(message.decimals);
    }
    if (message.image !== "") {
      writer.uint32(34).string(message.image);
    }
    if (message.index !== "") {
      writer.uint32(42).string(message.index);
    }
    if (message.properties !== undefined) {
      TokenMetadataProperties.encode(message.properties, writer.uint32(50).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 = createBaseQueryTokenMetadataResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.name = reader.string();
          break;
        case 2:
          message.description = reader.string();
          break;
        case 3:
          message.decimals = reader.string();
          break;
        case 4:
          message.image = reader.string();
          break;
        case 5:
          message.index = reader.string();
          break;
        case 6:
          message.properties = TokenMetadataProperties.decode(reader, reader.uint32());
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      name: isSet(object.name) ? String(object.name) : "",
      description: isSet(object.description) ? String(object.description) : "",
      decimals: isSet(object.decimals) ? String(object.decimals) : "",
      image: isSet(object.image) ? String(object.image) : "",
      index: isSet(object.index) ? String(object.index) : "",
      properties: isSet(object.properties) ? TokenMetadataProperties.fromJSON(object.properties) : undefined
    };
  },
  toJSON(message) {
    const obj = {};
    message.name !== undefined && (obj.name = message.name);
    message.description !== undefined && (obj.description = message.description);
    message.decimals !== undefined && (obj.decimals = message.decimals);
    message.image !== undefined && (obj.image = message.image);
    message.index !== undefined && (obj.index = message.index);
    message.properties !== undefined && (obj.properties = message.properties ? TokenMetadataProperties.toJSON(message.properties) : undefined);
    return obj;
  },
  fromPartial(object) {
    var _object$name, _object$description, _object$decimals, _object$image, _object$index;
    const message = createBaseQueryTokenMetadataResponse();
    message.name = (_object$name = object.name) !== null && _object$name !== void 0 ? _object$name : "";
    message.description = (_object$description = object.description) !== null && _object$description !== void 0 ? _object$description : "";
    message.decimals = (_object$decimals = object.decimals) !== null && _object$decimals !== void 0 ? _object$decimals : "";
    message.image = (_object$image = object.image) !== null && _object$image !== void 0 ? _object$image : "";
    message.index = (_object$index = object.index) !== null && _object$index !== void 0 ? _object$index : "";
    message.properties = object.properties !== undefined && object.properties !== null ? TokenMetadataProperties.fromPartial(object.properties) : undefined;
    return message;
  }
};
function createBaseTokenMetadataProperties() {
  return {
    class: "",
    collection: "",
    cap: "",
    linkedResources: []
  };
}
export const TokenMetadataProperties = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.class !== "") {
      writer.uint32(10).string(message.class);
    }
    if (message.collection !== "") {
      writer.uint32(18).string(message.collection);
    }
    if (message.cap !== "") {
      writer.uint32(26).string(message.cap);
    }
    for (const v of message.linkedResources) {
      TokenData.encode(v, writer.uint32(34).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 = createBaseTokenMetadataProperties();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.class = reader.string();
          break;
        case 2:
          message.collection = reader.string();
          break;
        case 3:
          message.cap = reader.string();
          break;
        case 4:
          message.linkedResources.push(TokenData.decode(reader, reader.uint32()));
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      class: isSet(object.class) ? String(object.class) : "",
      collection: isSet(object.collection) ? String(object.collection) : "",
      cap: isSet(object.cap) ? String(object.cap) : "",
      linkedResources: Array.isArray(object === null || object === void 0 ? void 0 : object.linkedResources) ? object.linkedResources.map(e => TokenData.fromJSON(e)) : []
    };
  },
  toJSON(message) {
    const obj = {};
    message.class !== undefined && (obj.class = message.class);
    message.collection !== undefined && (obj.collection = message.collection);
    message.cap !== undefined && (obj.cap = message.cap);
    if (message.linkedResources) {
      obj.linkedResources = message.linkedResources.map(e => e ? TokenData.toJSON(e) : undefined);
    } else {
      obj.linkedResources = [];
    }
    return obj;
  },
  fromPartial(object) {
    var _object$class, _object$collection, _object$cap, _object$linkedResourc;
    const message = createBaseTokenMetadataProperties();
    message.class = (_object$class = object.class) !== null && _object$class !== void 0 ? _object$class : "";
    message.collection = (_object$collection = object.collection) !== null && _object$collection !== void 0 ? _object$collection : "";
    message.cap = (_object$cap = object.cap) !== null && _object$cap !== void 0 ? _object$cap : "";
    message.linkedResources = ((_object$linkedResourc = object.linkedResources) === null || _object$linkedResourc === void 0 ? void 0 : _object$linkedResourc.map(e => TokenData.fromPartial(e))) || [];
    return message;
  }
};