//@ts-nocheck
import { Long, isSet } from "../../../helpers";
import * as _m0 from "protobufjs/minimal";
function createBaseParams() {
  return {
    ixo1155ContractCode: Long.UZERO
  };
}
export const Params = {
  encode(message, writer = _m0.Writer.create()) {
    if (!message.ixo1155ContractCode.isZero()) {
      writer.uint32(8).uint64(message.ixo1155ContractCode);
    }
    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 = createBaseParams();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.ixo1155ContractCode = reader.uint64();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      ixo1155ContractCode: isSet(object.ixo1155ContractCode) ? Long.fromValue(object.ixo1155ContractCode) : Long.UZERO
    };
  },
  toJSON(message) {
    const obj = {};
    message.ixo1155ContractCode !== undefined && (obj.ixo1155ContractCode = (message.ixo1155ContractCode || Long.UZERO).toString());
    return obj;
  },
  fromPartial(object) {
    const message = createBaseParams();
    message.ixo1155ContractCode = object.ixo1155ContractCode !== undefined && object.ixo1155ContractCode !== null ? Long.fromValue(object.ixo1155ContractCode) : Long.UZERO;
    return message;
  }
};
function createBaseToken() {
  return {
    minter: "",
    contractAddress: "",
    class: "",
    name: "",
    description: "",
    image: "",
    type: "",
    cap: "",
    supply: "",
    paused: false,
    stopped: false,
    retired: [],
    cancelled: [],
    transferred: []
  };
}
export const Token = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.minter !== "") {
      writer.uint32(10).string(message.minter);
    }
    if (message.contractAddress !== "") {
      writer.uint32(18).string(message.contractAddress);
    }
    if (message.class !== "") {
      writer.uint32(26).string(message.class);
    }
    if (message.name !== "") {
      writer.uint32(34).string(message.name);
    }
    if (message.description !== "") {
      writer.uint32(42).string(message.description);
    }
    if (message.image !== "") {
      writer.uint32(50).string(message.image);
    }
    if (message.type !== "") {
      writer.uint32(58).string(message.type);
    }
    if (message.cap !== "") {
      writer.uint32(66).string(message.cap);
    }
    if (message.supply !== "") {
      writer.uint32(74).string(message.supply);
    }
    if (message.paused === true) {
      writer.uint32(80).bool(message.paused);
    }
    if (message.stopped === true) {
      writer.uint32(88).bool(message.stopped);
    }
    for (const v of message.retired) {
      TokensRetired.encode(v, writer.uint32(98).fork()).ldelim();
    }
    for (const v of message.cancelled) {
      TokensCancelled.encode(v, writer.uint32(106).fork()).ldelim();
    }
    for (const v of message.transferred) {
      CreditsTransferred.encode(v, writer.uint32(114).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 = createBaseToken();
    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;
        case 3:
          message.class = reader.string();
          break;
        case 4:
          message.name = reader.string();
          break;
        case 5:
          message.description = reader.string();
          break;
        case 6:
          message.image = reader.string();
          break;
        case 7:
          message.type = reader.string();
          break;
        case 8:
          message.cap = reader.string();
          break;
        case 9:
          message.supply = reader.string();
          break;
        case 10:
          message.paused = reader.bool();
          break;
        case 11:
          message.stopped = reader.bool();
          break;
        case 12:
          message.retired.push(TokensRetired.decode(reader, reader.uint32()));
          break;
        case 13:
          message.cancelled.push(TokensCancelled.decode(reader, reader.uint32()));
          break;
        case 14:
          message.transferred.push(CreditsTransferred.decode(reader, reader.uint32()));
          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) : "",
      class: isSet(object.class) ? String(object.class) : "",
      name: isSet(object.name) ? String(object.name) : "",
      description: isSet(object.description) ? String(object.description) : "",
      image: isSet(object.image) ? String(object.image) : "",
      type: isSet(object.type) ? String(object.type) : "",
      cap: isSet(object.cap) ? String(object.cap) : "",
      supply: isSet(object.supply) ? String(object.supply) : "",
      paused: isSet(object.paused) ? Boolean(object.paused) : false,
      stopped: isSet(object.stopped) ? Boolean(object.stopped) : false,
      retired: Array.isArray(object === null || object === void 0 ? void 0 : object.retired) ? object.retired.map(e => TokensRetired.fromJSON(e)) : [],
      cancelled: Array.isArray(object === null || object === void 0 ? void 0 : object.cancelled) ? object.cancelled.map(e => TokensCancelled.fromJSON(e)) : [],
      transferred: Array.isArray(object === null || object === void 0 ? void 0 : object.transferred) ? object.transferred.map(e => CreditsTransferred.fromJSON(e)) : []
    };
  },
  toJSON(message) {
    const obj = {};
    message.minter !== undefined && (obj.minter = message.minter);
    message.contractAddress !== undefined && (obj.contractAddress = message.contractAddress);
    message.class !== undefined && (obj.class = message.class);
    message.name !== undefined && (obj.name = message.name);
    message.description !== undefined && (obj.description = message.description);
    message.image !== undefined && (obj.image = message.image);
    message.type !== undefined && (obj.type = message.type);
    message.cap !== undefined && (obj.cap = message.cap);
    message.supply !== undefined && (obj.supply = message.supply);
    message.paused !== undefined && (obj.paused = message.paused);
    message.stopped !== undefined && (obj.stopped = message.stopped);
    if (message.retired) {
      obj.retired = message.retired.map(e => e ? TokensRetired.toJSON(e) : undefined);
    } else {
      obj.retired = [];
    }
    if (message.cancelled) {
      obj.cancelled = message.cancelled.map(e => e ? TokensCancelled.toJSON(e) : undefined);
    } else {
      obj.cancelled = [];
    }
    if (message.transferred) {
      obj.transferred = message.transferred.map(e => e ? CreditsTransferred.toJSON(e) : undefined);
    } else {
      obj.transferred = [];
    }
    return obj;
  },
  fromPartial(object) {
    var _object$minter, _object$contractAddre, _object$class, _object$name, _object$description, _object$image, _object$type, _object$cap, _object$supply, _object$paused, _object$stopped, _object$retired, _object$cancelled, _object$transferred;
    const message = createBaseToken();
    message.minter = (_object$minter = object.minter) !== null && _object$minter !== void 0 ? _object$minter : "";
    message.contractAddress = (_object$contractAddre = object.contractAddress) !== null && _object$contractAddre !== void 0 ? _object$contractAddre : "";
    message.class = (_object$class = object.class) !== null && _object$class !== void 0 ? _object$class : "";
    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.image = (_object$image = object.image) !== null && _object$image !== void 0 ? _object$image : "";
    message.type = (_object$type = object.type) !== null && _object$type !== void 0 ? _object$type : "";
    message.cap = (_object$cap = object.cap) !== null && _object$cap !== void 0 ? _object$cap : "";
    message.supply = (_object$supply = object.supply) !== null && _object$supply !== void 0 ? _object$supply : "";
    message.paused = (_object$paused = object.paused) !== null && _object$paused !== void 0 ? _object$paused : false;
    message.stopped = (_object$stopped = object.stopped) !== null && _object$stopped !== void 0 ? _object$stopped : false;
    message.retired = ((_object$retired = object.retired) === null || _object$retired === void 0 ? void 0 : _object$retired.map(e => TokensRetired.fromPartial(e))) || [];
    message.cancelled = ((_object$cancelled = object.cancelled) === null || _object$cancelled === void 0 ? void 0 : _object$cancelled.map(e => TokensCancelled.fromPartial(e))) || [];
    message.transferred = ((_object$transferred = object.transferred) === null || _object$transferred === void 0 ? void 0 : _object$transferred.map(e => CreditsTransferred.fromPartial(e))) || [];
    return message;
  }
};
function createBaseTokensRetired() {
  return {
    id: "",
    reason: "",
    jurisdiction: "",
    amount: "",
    owner: ""
  };
}
export const TokensRetired = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.id !== "") {
      writer.uint32(10).string(message.id);
    }
    if (message.reason !== "") {
      writer.uint32(18).string(message.reason);
    }
    if (message.jurisdiction !== "") {
      writer.uint32(26).string(message.jurisdiction);
    }
    if (message.amount !== "") {
      writer.uint32(34).string(message.amount);
    }
    if (message.owner !== "") {
      writer.uint32(42).string(message.owner);
    }
    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 = createBaseTokensRetired();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.id = reader.string();
          break;
        case 2:
          message.reason = reader.string();
          break;
        case 3:
          message.jurisdiction = reader.string();
          break;
        case 4:
          message.amount = reader.string();
          break;
        case 5:
          message.owner = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      id: isSet(object.id) ? String(object.id) : "",
      reason: isSet(object.reason) ? String(object.reason) : "",
      jurisdiction: isSet(object.jurisdiction) ? String(object.jurisdiction) : "",
      amount: isSet(object.amount) ? String(object.amount) : "",
      owner: isSet(object.owner) ? String(object.owner) : ""
    };
  },
  toJSON(message) {
    const obj = {};
    message.id !== undefined && (obj.id = message.id);
    message.reason !== undefined && (obj.reason = message.reason);
    message.jurisdiction !== undefined && (obj.jurisdiction = message.jurisdiction);
    message.amount !== undefined && (obj.amount = message.amount);
    message.owner !== undefined && (obj.owner = message.owner);
    return obj;
  },
  fromPartial(object) {
    var _object$id, _object$reason, _object$jurisdiction, _object$amount, _object$owner;
    const message = createBaseTokensRetired();
    message.id = (_object$id = object.id) !== null && _object$id !== void 0 ? _object$id : "";
    message.reason = (_object$reason = object.reason) !== null && _object$reason !== void 0 ? _object$reason : "";
    message.jurisdiction = (_object$jurisdiction = object.jurisdiction) !== null && _object$jurisdiction !== void 0 ? _object$jurisdiction : "";
    message.amount = (_object$amount = object.amount) !== null && _object$amount !== void 0 ? _object$amount : "";
    message.owner = (_object$owner = object.owner) !== null && _object$owner !== void 0 ? _object$owner : "";
    return message;
  }
};
function createBaseCreditsTransferred() {
  return {
    id: "",
    reason: "",
    jurisdiction: "",
    amount: "",
    owner: "",
    authorizationId: ""
  };
}
export const CreditsTransferred = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.id !== "") {
      writer.uint32(10).string(message.id);
    }
    if (message.reason !== "") {
      writer.uint32(18).string(message.reason);
    }
    if (message.jurisdiction !== "") {
      writer.uint32(26).string(message.jurisdiction);
    }
    if (message.amount !== "") {
      writer.uint32(34).string(message.amount);
    }
    if (message.owner !== "") {
      writer.uint32(42).string(message.owner);
    }
    if (message.authorizationId !== "") {
      writer.uint32(50).string(message.authorizationId);
    }
    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 = createBaseCreditsTransferred();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.id = reader.string();
          break;
        case 2:
          message.reason = reader.string();
          break;
        case 3:
          message.jurisdiction = reader.string();
          break;
        case 4:
          message.amount = reader.string();
          break;
        case 5:
          message.owner = reader.string();
          break;
        case 6:
          message.authorizationId = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      id: isSet(object.id) ? String(object.id) : "",
      reason: isSet(object.reason) ? String(object.reason) : "",
      jurisdiction: isSet(object.jurisdiction) ? String(object.jurisdiction) : "",
      amount: isSet(object.amount) ? String(object.amount) : "",
      owner: isSet(object.owner) ? String(object.owner) : "",
      authorizationId: isSet(object.authorizationId) ? String(object.authorizationId) : ""
    };
  },
  toJSON(message) {
    const obj = {};
    message.id !== undefined && (obj.id = message.id);
    message.reason !== undefined && (obj.reason = message.reason);
    message.jurisdiction !== undefined && (obj.jurisdiction = message.jurisdiction);
    message.amount !== undefined && (obj.amount = message.amount);
    message.owner !== undefined && (obj.owner = message.owner);
    message.authorizationId !== undefined && (obj.authorizationId = message.authorizationId);
    return obj;
  },
  fromPartial(object) {
    var _object$id2, _object$reason2, _object$jurisdiction2, _object$amount2, _object$owner2, _object$authorization;
    const message = createBaseCreditsTransferred();
    message.id = (_object$id2 = object.id) !== null && _object$id2 !== void 0 ? _object$id2 : "";
    message.reason = (_object$reason2 = object.reason) !== null && _object$reason2 !== void 0 ? _object$reason2 : "";
    message.jurisdiction = (_object$jurisdiction2 = object.jurisdiction) !== null && _object$jurisdiction2 !== void 0 ? _object$jurisdiction2 : "";
    message.amount = (_object$amount2 = object.amount) !== null && _object$amount2 !== void 0 ? _object$amount2 : "";
    message.owner = (_object$owner2 = object.owner) !== null && _object$owner2 !== void 0 ? _object$owner2 : "";
    message.authorizationId = (_object$authorization = object.authorizationId) !== null && _object$authorization !== void 0 ? _object$authorization : "";
    return message;
  }
};
function createBaseTokensCancelled() {
  return {
    id: "",
    reason: "",
    amount: "",
    owner: ""
  };
}
export const TokensCancelled = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.id !== "") {
      writer.uint32(10).string(message.id);
    }
    if (message.reason !== "") {
      writer.uint32(18).string(message.reason);
    }
    if (message.amount !== "") {
      writer.uint32(26).string(message.amount);
    }
    if (message.owner !== "") {
      writer.uint32(34).string(message.owner);
    }
    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 = createBaseTokensCancelled();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.id = reader.string();
          break;
        case 2:
          message.reason = reader.string();
          break;
        case 3:
          message.amount = reader.string();
          break;
        case 4:
          message.owner = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      id: isSet(object.id) ? String(object.id) : "",
      reason: isSet(object.reason) ? String(object.reason) : "",
      amount: isSet(object.amount) ? String(object.amount) : "",
      owner: isSet(object.owner) ? String(object.owner) : ""
    };
  },
  toJSON(message) {
    const obj = {};
    message.id !== undefined && (obj.id = message.id);
    message.reason !== undefined && (obj.reason = message.reason);
    message.amount !== undefined && (obj.amount = message.amount);
    message.owner !== undefined && (obj.owner = message.owner);
    return obj;
  },
  fromPartial(object) {
    var _object$id3, _object$reason3, _object$amount3, _object$owner3;
    const message = createBaseTokensCancelled();
    message.id = (_object$id3 = object.id) !== null && _object$id3 !== void 0 ? _object$id3 : "";
    message.reason = (_object$reason3 = object.reason) !== null && _object$reason3 !== void 0 ? _object$reason3 : "";
    message.amount = (_object$amount3 = object.amount) !== null && _object$amount3 !== void 0 ? _object$amount3 : "";
    message.owner = (_object$owner3 = object.owner) !== null && _object$owner3 !== void 0 ? _object$owner3 : "";
    return message;
  }
};
function createBaseTokenProperties() {
  return {
    id: "",
    index: "",
    name: "",
    collection: "",
    tokenData: []
  };
}
export const TokenProperties = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.id !== "") {
      writer.uint32(10).string(message.id);
    }
    if (message.index !== "") {
      writer.uint32(18).string(message.index);
    }
    if (message.name !== "") {
      writer.uint32(26).string(message.name);
    }
    if (message.collection !== "") {
      writer.uint32(34).string(message.collection);
    }
    for (const v of message.tokenData) {
      TokenData.encode(v, writer.uint32(42).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 = createBaseTokenProperties();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.id = reader.string();
          break;
        case 2:
          message.index = reader.string();
          break;
        case 3:
          message.name = reader.string();
          break;
        case 4:
          message.collection = reader.string();
          break;
        case 5:
          message.tokenData.push(TokenData.decode(reader, reader.uint32()));
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      id: isSet(object.id) ? String(object.id) : "",
      index: isSet(object.index) ? String(object.index) : "",
      name: isSet(object.name) ? String(object.name) : "",
      collection: isSet(object.collection) ? String(object.collection) : "",
      tokenData: Array.isArray(object === null || object === void 0 ? void 0 : object.tokenData) ? object.tokenData.map(e => TokenData.fromJSON(e)) : []
    };
  },
  toJSON(message) {
    const obj = {};
    message.id !== undefined && (obj.id = message.id);
    message.index !== undefined && (obj.index = message.index);
    message.name !== undefined && (obj.name = message.name);
    message.collection !== undefined && (obj.collection = message.collection);
    if (message.tokenData) {
      obj.tokenData = message.tokenData.map(e => e ? TokenData.toJSON(e) : undefined);
    } else {
      obj.tokenData = [];
    }
    return obj;
  },
  fromPartial(object) {
    var _object$id4, _object$index, _object$name2, _object$collection, _object$tokenData;
    const message = createBaseTokenProperties();
    message.id = (_object$id4 = object.id) !== null && _object$id4 !== void 0 ? _object$id4 : "";
    message.index = (_object$index = object.index) !== null && _object$index !== void 0 ? _object$index : "";
    message.name = (_object$name2 = object.name) !== null && _object$name2 !== void 0 ? _object$name2 : "";
    message.collection = (_object$collection = object.collection) !== null && _object$collection !== void 0 ? _object$collection : "";
    message.tokenData = ((_object$tokenData = object.tokenData) === null || _object$tokenData === void 0 ? void 0 : _object$tokenData.map(e => TokenData.fromPartial(e))) || [];
    return message;
  }
};
function createBaseTokenData() {
  return {
    uri: "",
    encrypted: false,
    proof: "",
    type: "",
    id: ""
  };
}
export const TokenData = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.uri !== "") {
      writer.uint32(10).string(message.uri);
    }
    if (message.encrypted === true) {
      writer.uint32(16).bool(message.encrypted);
    }
    if (message.proof !== "") {
      writer.uint32(26).string(message.proof);
    }
    if (message.type !== "") {
      writer.uint32(34).string(message.type);
    }
    if (message.id !== "") {
      writer.uint32(42).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 = createBaseTokenData();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.uri = reader.string();
          break;
        case 2:
          message.encrypted = reader.bool();
          break;
        case 3:
          message.proof = reader.string();
          break;
        case 4:
          message.type = reader.string();
          break;
        case 5:
          message.id = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      uri: isSet(object.uri) ? String(object.uri) : "",
      encrypted: isSet(object.encrypted) ? Boolean(object.encrypted) : false,
      proof: isSet(object.proof) ? String(object.proof) : "",
      type: isSet(object.type) ? String(object.type) : "",
      id: isSet(object.id) ? String(object.id) : ""
    };
  },
  toJSON(message) {
    const obj = {};
    message.uri !== undefined && (obj.uri = message.uri);
    message.encrypted !== undefined && (obj.encrypted = message.encrypted);
    message.proof !== undefined && (obj.proof = message.proof);
    message.type !== undefined && (obj.type = message.type);
    message.id !== undefined && (obj.id = message.id);
    return obj;
  },
  fromPartial(object) {
    var _object$uri, _object$encrypted, _object$proof, _object$type2, _object$id5;
    const message = createBaseTokenData();
    message.uri = (_object$uri = object.uri) !== null && _object$uri !== void 0 ? _object$uri : "";
    message.encrypted = (_object$encrypted = object.encrypted) !== null && _object$encrypted !== void 0 ? _object$encrypted : false;
    message.proof = (_object$proof = object.proof) !== null && _object$proof !== void 0 ? _object$proof : "";
    message.type = (_object$type2 = object.type) !== null && _object$type2 !== void 0 ? _object$type2 : "";
    message.id = (_object$id5 = object.id) !== null && _object$id5 !== void 0 ? _object$id5 : "";
    return message;
  }
};