//@ts-nocheck
import { Timestamp } from "../../../google/protobuf/timestamp";
import { Payments, CW20Payment, CW1155Payment, DisputeData, Contract1155Payment, collectionStateFromJSON, collectionIntentOptionsFromJSON, collectionStateToJSON, collectionIntentOptionsToJSON, evaluationStatusFromJSON, evaluationStatusToJSON, paymentTypeFromJSON, paymentTypeToJSON } from "./claims";
import { Coin } from "../../../cosmos/base/v1beta1/coin";
import { Input, Output } from "../../../cosmos/bank/v1beta1/bank";
import { createClaimAuthorizationTypeFromJSON, createClaimAuthorizationTypeToJSON } from "./authz";
import { Duration } from "../../../google/protobuf/duration";
import { Long, isSet, fromJsonTimestamp, fromTimestamp } from "../../../helpers";
import * as _m0 from "protobufjs/minimal";

/**
 * Agent laying dispute must be admin for Collection, or controller on
 * Collection entity, or have authz cap, aka is agent
 */

/**
 * Agent laying dispute must be admin for Collection, or controller on
 * Collection entity, or have authz cap, aka is agent
 */

/** MsgClaimIntentResponse defines the response after submitting an intent. */

/** MsgClaimIntentResponse defines the response after submitting an intent. */

/**
 * MsgCreateClaimAuthorization defines a message for creating a claim
 * authorization on behalf of an entity admin account (SubmitClaimAuthorization
 * or EvaluateClaimAuthorization)
 */

/**
 * MsgCreateClaimAuthorization defines a message for creating a claim
 * authorization on behalf of an entity admin account (SubmitClaimAuthorization
 * or EvaluateClaimAuthorization)
 */

/**
 * MsgCreateClaimAuthorizationResponse defines the response for creating a claim
 * authorization
 */

/**
 * MsgCreateClaimAuthorizationResponse defines the response for creating a claim
 * authorization
 */

function createBaseMsgCreateCollection() {
  return {
    entity: "",
    signer: "",
    protocol: "",
    startDate: undefined,
    endDate: undefined,
    quota: Long.UZERO,
    state: 0,
    payments: undefined,
    intents: 0
  };
}
export const MsgCreateCollection = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.entity !== "") {
      writer.uint32(10).string(message.entity);
    }
    if (message.signer !== "") {
      writer.uint32(18).string(message.signer);
    }
    if (message.protocol !== "") {
      writer.uint32(26).string(message.protocol);
    }
    if (message.startDate !== undefined) {
      Timestamp.encode(message.startDate, writer.uint32(34).fork()).ldelim();
    }
    if (message.endDate !== undefined) {
      Timestamp.encode(message.endDate, writer.uint32(42).fork()).ldelim();
    }
    if (!message.quota.isZero()) {
      writer.uint32(48).uint64(message.quota);
    }
    if (message.state !== 0) {
      writer.uint32(56).int32(message.state);
    }
    if (message.payments !== undefined) {
      Payments.encode(message.payments, writer.uint32(66).fork()).ldelim();
    }
    if (message.intents !== 0) {
      writer.uint32(72).int32(message.intents);
    }
    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 = createBaseMsgCreateCollection();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.entity = reader.string();
          break;
        case 2:
          message.signer = reader.string();
          break;
        case 3:
          message.protocol = reader.string();
          break;
        case 4:
          message.startDate = Timestamp.decode(reader, reader.uint32());
          break;
        case 5:
          message.endDate = Timestamp.decode(reader, reader.uint32());
          break;
        case 6:
          message.quota = reader.uint64();
          break;
        case 7:
          message.state = reader.int32();
          break;
        case 8:
          message.payments = Payments.decode(reader, reader.uint32());
          break;
        case 9:
          message.intents = reader.int32();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      entity: isSet(object.entity) ? String(object.entity) : "",
      signer: isSet(object.signer) ? String(object.signer) : "",
      protocol: isSet(object.protocol) ? String(object.protocol) : "",
      startDate: isSet(object.startDate) ? fromJsonTimestamp(object.startDate) : undefined,
      endDate: isSet(object.endDate) ? fromJsonTimestamp(object.endDate) : undefined,
      quota: isSet(object.quota) ? Long.fromValue(object.quota) : Long.UZERO,
      state: isSet(object.state) ? collectionStateFromJSON(object.state) : 0,
      payments: isSet(object.payments) ? Payments.fromJSON(object.payments) : undefined,
      intents: isSet(object.intents) ? collectionIntentOptionsFromJSON(object.intents) : 0
    };
  },
  toJSON(message) {
    const obj = {};
    message.entity !== undefined && (obj.entity = message.entity);
    message.signer !== undefined && (obj.signer = message.signer);
    message.protocol !== undefined && (obj.protocol = message.protocol);
    message.startDate !== undefined && (obj.startDate = fromTimestamp(message.startDate).toISOString());
    message.endDate !== undefined && (obj.endDate = fromTimestamp(message.endDate).toISOString());
    message.quota !== undefined && (obj.quota = (message.quota || Long.UZERO).toString());
    message.state !== undefined && (obj.state = collectionStateToJSON(message.state));
    message.payments !== undefined && (obj.payments = message.payments ? Payments.toJSON(message.payments) : undefined);
    message.intents !== undefined && (obj.intents = collectionIntentOptionsToJSON(message.intents));
    return obj;
  },
  fromPartial(object) {
    var _object$entity, _object$signer, _object$protocol, _object$state, _object$intents;
    const message = createBaseMsgCreateCollection();
    message.entity = (_object$entity = object.entity) !== null && _object$entity !== void 0 ? _object$entity : "";
    message.signer = (_object$signer = object.signer) !== null && _object$signer !== void 0 ? _object$signer : "";
    message.protocol = (_object$protocol = object.protocol) !== null && _object$protocol !== void 0 ? _object$protocol : "";
    message.startDate = object.startDate !== undefined && object.startDate !== null ? Timestamp.fromPartial(object.startDate) : undefined;
    message.endDate = object.endDate !== undefined && object.endDate !== null ? Timestamp.fromPartial(object.endDate) : undefined;
    message.quota = object.quota !== undefined && object.quota !== null ? Long.fromValue(object.quota) : Long.UZERO;
    message.state = (_object$state = object.state) !== null && _object$state !== void 0 ? _object$state : 0;
    message.payments = object.payments !== undefined && object.payments !== null ? Payments.fromPartial(object.payments) : undefined;
    message.intents = (_object$intents = object.intents) !== null && _object$intents !== void 0 ? _object$intents : 0;
    return message;
  }
};
function createBaseMsgCreateCollectionResponse() {
  return {};
}
export const MsgCreateCollectionResponse = {
  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 = createBaseMsgCreateCollectionResponse();
    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 = createBaseMsgCreateCollectionResponse();
    return message;
  }
};
function createBaseMsgSubmitClaim() {
  return {
    collectionId: "",
    claimId: "",
    agentDid: "",
    agentAddress: "",
    adminAddress: "",
    useIntent: false,
    amount: [],
    cw20Payment: [],
    cw1155Payment: []
  };
}
export const MsgSubmitClaim = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.collectionId !== "") {
      writer.uint32(10).string(message.collectionId);
    }
    if (message.claimId !== "") {
      writer.uint32(18).string(message.claimId);
    }
    if (message.agentDid !== "") {
      writer.uint32(26).string(message.agentDid);
    }
    if (message.agentAddress !== "") {
      writer.uint32(34).string(message.agentAddress);
    }
    if (message.adminAddress !== "") {
      writer.uint32(42).string(message.adminAddress);
    }
    if (message.useIntent === true) {
      writer.uint32(48).bool(message.useIntent);
    }
    for (const v of message.amount) {
      Coin.encode(v, writer.uint32(58).fork()).ldelim();
    }
    for (const v of message.cw20Payment) {
      CW20Payment.encode(v, writer.uint32(66).fork()).ldelim();
    }
    for (const v of message.cw1155Payment) {
      CW1155Payment.encode(v, writer.uint32(74).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 = createBaseMsgSubmitClaim();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.collectionId = reader.string();
          break;
        case 2:
          message.claimId = reader.string();
          break;
        case 3:
          message.agentDid = reader.string();
          break;
        case 4:
          message.agentAddress = reader.string();
          break;
        case 5:
          message.adminAddress = reader.string();
          break;
        case 6:
          message.useIntent = reader.bool();
          break;
        case 7:
          message.amount.push(Coin.decode(reader, reader.uint32()));
          break;
        case 8:
          message.cw20Payment.push(CW20Payment.decode(reader, reader.uint32()));
          break;
        case 9:
          message.cw1155Payment.push(CW1155Payment.decode(reader, reader.uint32()));
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      collectionId: isSet(object.collectionId) ? String(object.collectionId) : "",
      claimId: isSet(object.claimId) ? String(object.claimId) : "",
      agentDid: isSet(object.agentDid) ? String(object.agentDid) : "",
      agentAddress: isSet(object.agentAddress) ? String(object.agentAddress) : "",
      adminAddress: isSet(object.adminAddress) ? String(object.adminAddress) : "",
      useIntent: isSet(object.useIntent) ? Boolean(object.useIntent) : false,
      amount: Array.isArray(object === null || object === void 0 ? void 0 : object.amount) ? object.amount.map(e => Coin.fromJSON(e)) : [],
      cw20Payment: Array.isArray(object === null || object === void 0 ? void 0 : object.cw20Payment) ? object.cw20Payment.map(e => CW20Payment.fromJSON(e)) : [],
      cw1155Payment: Array.isArray(object === null || object === void 0 ? void 0 : object.cw1155Payment) ? object.cw1155Payment.map(e => CW1155Payment.fromJSON(e)) : []
    };
  },
  toJSON(message) {
    const obj = {};
    message.collectionId !== undefined && (obj.collectionId = message.collectionId);
    message.claimId !== undefined && (obj.claimId = message.claimId);
    message.agentDid !== undefined && (obj.agentDid = message.agentDid);
    message.agentAddress !== undefined && (obj.agentAddress = message.agentAddress);
    message.adminAddress !== undefined && (obj.adminAddress = message.adminAddress);
    message.useIntent !== undefined && (obj.useIntent = message.useIntent);
    if (message.amount) {
      obj.amount = message.amount.map(e => e ? Coin.toJSON(e) : undefined);
    } else {
      obj.amount = [];
    }
    if (message.cw20Payment) {
      obj.cw20Payment = message.cw20Payment.map(e => e ? CW20Payment.toJSON(e) : undefined);
    } else {
      obj.cw20Payment = [];
    }
    if (message.cw1155Payment) {
      obj.cw1155Payment = message.cw1155Payment.map(e => e ? CW1155Payment.toJSON(e) : undefined);
    } else {
      obj.cw1155Payment = [];
    }
    return obj;
  },
  fromPartial(object) {
    var _object$collectionId, _object$claimId, _object$agentDid, _object$agentAddress, _object$adminAddress, _object$useIntent, _object$amount, _object$cw20Payment, _object$cw1155Payment;
    const message = createBaseMsgSubmitClaim();
    message.collectionId = (_object$collectionId = object.collectionId) !== null && _object$collectionId !== void 0 ? _object$collectionId : "";
    message.claimId = (_object$claimId = object.claimId) !== null && _object$claimId !== void 0 ? _object$claimId : "";
    message.agentDid = (_object$agentDid = object.agentDid) !== null && _object$agentDid !== void 0 ? _object$agentDid : "";
    message.agentAddress = (_object$agentAddress = object.agentAddress) !== null && _object$agentAddress !== void 0 ? _object$agentAddress : "";
    message.adminAddress = (_object$adminAddress = object.adminAddress) !== null && _object$adminAddress !== void 0 ? _object$adminAddress : "";
    message.useIntent = (_object$useIntent = object.useIntent) !== null && _object$useIntent !== void 0 ? _object$useIntent : false;
    message.amount = ((_object$amount = object.amount) === null || _object$amount === void 0 ? void 0 : _object$amount.map(e => Coin.fromPartial(e))) || [];
    message.cw20Payment = ((_object$cw20Payment = object.cw20Payment) === null || _object$cw20Payment === void 0 ? void 0 : _object$cw20Payment.map(e => CW20Payment.fromPartial(e))) || [];
    message.cw1155Payment = ((_object$cw1155Payment = object.cw1155Payment) === null || _object$cw1155Payment === void 0 ? void 0 : _object$cw1155Payment.map(e => CW1155Payment.fromPartial(e))) || [];
    return message;
  }
};
function createBaseMsgSubmitClaimResponse() {
  return {};
}
export const MsgSubmitClaimResponse = {
  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 = createBaseMsgSubmitClaimResponse();
    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 = createBaseMsgSubmitClaimResponse();
    return message;
  }
};
function createBaseMsgEvaluateClaim() {
  return {
    claimId: "",
    collectionId: "",
    oracle: "",
    agentDid: "",
    agentAddress: "",
    adminAddress: "",
    status: 0,
    reason: 0,
    verificationProof: "",
    amount: [],
    cw20Payment: [],
    cw1155Payment: []
  };
}
export const MsgEvaluateClaim = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.claimId !== "") {
      writer.uint32(10).string(message.claimId);
    }
    if (message.collectionId !== "") {
      writer.uint32(18).string(message.collectionId);
    }
    if (message.oracle !== "") {
      writer.uint32(26).string(message.oracle);
    }
    if (message.agentDid !== "") {
      writer.uint32(34).string(message.agentDid);
    }
    if (message.agentAddress !== "") {
      writer.uint32(42).string(message.agentAddress);
    }
    if (message.adminAddress !== "") {
      writer.uint32(50).string(message.adminAddress);
    }
    if (message.status !== 0) {
      writer.uint32(56).int32(message.status);
    }
    if (message.reason !== 0) {
      writer.uint32(64).uint32(message.reason);
    }
    if (message.verificationProof !== "") {
      writer.uint32(74).string(message.verificationProof);
    }
    for (const v of message.amount) {
      Coin.encode(v, writer.uint32(82).fork()).ldelim();
    }
    for (const v of message.cw20Payment) {
      CW20Payment.encode(v, writer.uint32(90).fork()).ldelim();
    }
    for (const v of message.cw1155Payment) {
      CW1155Payment.encode(v, writer.uint32(98).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 = createBaseMsgEvaluateClaim();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.claimId = reader.string();
          break;
        case 2:
          message.collectionId = reader.string();
          break;
        case 3:
          message.oracle = reader.string();
          break;
        case 4:
          message.agentDid = reader.string();
          break;
        case 5:
          message.agentAddress = reader.string();
          break;
        case 6:
          message.adminAddress = reader.string();
          break;
        case 7:
          message.status = reader.int32();
          break;
        case 8:
          message.reason = reader.uint32();
          break;
        case 9:
          message.verificationProof = reader.string();
          break;
        case 10:
          message.amount.push(Coin.decode(reader, reader.uint32()));
          break;
        case 11:
          message.cw20Payment.push(CW20Payment.decode(reader, reader.uint32()));
          break;
        case 12:
          message.cw1155Payment.push(CW1155Payment.decode(reader, reader.uint32()));
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      claimId: isSet(object.claimId) ? String(object.claimId) : "",
      collectionId: isSet(object.collectionId) ? String(object.collectionId) : "",
      oracle: isSet(object.oracle) ? String(object.oracle) : "",
      agentDid: isSet(object.agentDid) ? String(object.agentDid) : "",
      agentAddress: isSet(object.agentAddress) ? String(object.agentAddress) : "",
      adminAddress: isSet(object.adminAddress) ? String(object.adminAddress) : "",
      status: isSet(object.status) ? evaluationStatusFromJSON(object.status) : 0,
      reason: isSet(object.reason) ? Number(object.reason) : 0,
      verificationProof: isSet(object.verificationProof) ? String(object.verificationProof) : "",
      amount: Array.isArray(object === null || object === void 0 ? void 0 : object.amount) ? object.amount.map(e => Coin.fromJSON(e)) : [],
      cw20Payment: Array.isArray(object === null || object === void 0 ? void 0 : object.cw20Payment) ? object.cw20Payment.map(e => CW20Payment.fromJSON(e)) : [],
      cw1155Payment: Array.isArray(object === null || object === void 0 ? void 0 : object.cw1155Payment) ? object.cw1155Payment.map(e => CW1155Payment.fromJSON(e)) : []
    };
  },
  toJSON(message) {
    const obj = {};
    message.claimId !== undefined && (obj.claimId = message.claimId);
    message.collectionId !== undefined && (obj.collectionId = message.collectionId);
    message.oracle !== undefined && (obj.oracle = message.oracle);
    message.agentDid !== undefined && (obj.agentDid = message.agentDid);
    message.agentAddress !== undefined && (obj.agentAddress = message.agentAddress);
    message.adminAddress !== undefined && (obj.adminAddress = message.adminAddress);
    message.status !== undefined && (obj.status = evaluationStatusToJSON(message.status));
    message.reason !== undefined && (obj.reason = Math.round(message.reason));
    message.verificationProof !== undefined && (obj.verificationProof = message.verificationProof);
    if (message.amount) {
      obj.amount = message.amount.map(e => e ? Coin.toJSON(e) : undefined);
    } else {
      obj.amount = [];
    }
    if (message.cw20Payment) {
      obj.cw20Payment = message.cw20Payment.map(e => e ? CW20Payment.toJSON(e) : undefined);
    } else {
      obj.cw20Payment = [];
    }
    if (message.cw1155Payment) {
      obj.cw1155Payment = message.cw1155Payment.map(e => e ? CW1155Payment.toJSON(e) : undefined);
    } else {
      obj.cw1155Payment = [];
    }
    return obj;
  },
  fromPartial(object) {
    var _object$claimId2, _object$collectionId2, _object$oracle, _object$agentDid2, _object$agentAddress2, _object$adminAddress2, _object$status, _object$reason, _object$verificationP, _object$amount2, _object$cw20Payment2, _object$cw1155Payment2;
    const message = createBaseMsgEvaluateClaim();
    message.claimId = (_object$claimId2 = object.claimId) !== null && _object$claimId2 !== void 0 ? _object$claimId2 : "";
    message.collectionId = (_object$collectionId2 = object.collectionId) !== null && _object$collectionId2 !== void 0 ? _object$collectionId2 : "";
    message.oracle = (_object$oracle = object.oracle) !== null && _object$oracle !== void 0 ? _object$oracle : "";
    message.agentDid = (_object$agentDid2 = object.agentDid) !== null && _object$agentDid2 !== void 0 ? _object$agentDid2 : "";
    message.agentAddress = (_object$agentAddress2 = object.agentAddress) !== null && _object$agentAddress2 !== void 0 ? _object$agentAddress2 : "";
    message.adminAddress = (_object$adminAddress2 = object.adminAddress) !== null && _object$adminAddress2 !== void 0 ? _object$adminAddress2 : "";
    message.status = (_object$status = object.status) !== null && _object$status !== void 0 ? _object$status : 0;
    message.reason = (_object$reason = object.reason) !== null && _object$reason !== void 0 ? _object$reason : 0;
    message.verificationProof = (_object$verificationP = object.verificationProof) !== null && _object$verificationP !== void 0 ? _object$verificationP : "";
    message.amount = ((_object$amount2 = object.amount) === null || _object$amount2 === void 0 ? void 0 : _object$amount2.map(e => Coin.fromPartial(e))) || [];
    message.cw20Payment = ((_object$cw20Payment2 = object.cw20Payment) === null || _object$cw20Payment2 === void 0 ? void 0 : _object$cw20Payment2.map(e => CW20Payment.fromPartial(e))) || [];
    message.cw1155Payment = ((_object$cw1155Payment2 = object.cw1155Payment) === null || _object$cw1155Payment2 === void 0 ? void 0 : _object$cw1155Payment2.map(e => CW1155Payment.fromPartial(e))) || [];
    return message;
  }
};
function createBaseMsgEvaluateClaimResponse() {
  return {};
}
export const MsgEvaluateClaimResponse = {
  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 = createBaseMsgEvaluateClaimResponse();
    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 = createBaseMsgEvaluateClaimResponse();
    return message;
  }
};
function createBaseMsgDisputeClaim() {
  return {
    subjectId: "",
    agentDid: "",
    agentAddress: "",
    disputeType: 0,
    data: undefined
  };
}
export const MsgDisputeClaim = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.subjectId !== "") {
      writer.uint32(10).string(message.subjectId);
    }
    if (message.agentDid !== "") {
      writer.uint32(18).string(message.agentDid);
    }
    if (message.agentAddress !== "") {
      writer.uint32(26).string(message.agentAddress);
    }
    if (message.disputeType !== 0) {
      writer.uint32(32).int32(message.disputeType);
    }
    if (message.data !== undefined) {
      DisputeData.encode(message.data, 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 = createBaseMsgDisputeClaim();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.subjectId = reader.string();
          break;
        case 2:
          message.agentDid = reader.string();
          break;
        case 3:
          message.agentAddress = reader.string();
          break;
        case 4:
          message.disputeType = reader.int32();
          break;
        case 5:
          message.data = DisputeData.decode(reader, reader.uint32());
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      subjectId: isSet(object.subjectId) ? String(object.subjectId) : "",
      agentDid: isSet(object.agentDid) ? String(object.agentDid) : "",
      agentAddress: isSet(object.agentAddress) ? String(object.agentAddress) : "",
      disputeType: isSet(object.disputeType) ? Number(object.disputeType) : 0,
      data: isSet(object.data) ? DisputeData.fromJSON(object.data) : undefined
    };
  },
  toJSON(message) {
    const obj = {};
    message.subjectId !== undefined && (obj.subjectId = message.subjectId);
    message.agentDid !== undefined && (obj.agentDid = message.agentDid);
    message.agentAddress !== undefined && (obj.agentAddress = message.agentAddress);
    message.disputeType !== undefined && (obj.disputeType = Math.round(message.disputeType));
    message.data !== undefined && (obj.data = message.data ? DisputeData.toJSON(message.data) : undefined);
    return obj;
  },
  fromPartial(object) {
    var _object$subjectId, _object$agentDid3, _object$agentAddress3, _object$disputeType;
    const message = createBaseMsgDisputeClaim();
    message.subjectId = (_object$subjectId = object.subjectId) !== null && _object$subjectId !== void 0 ? _object$subjectId : "";
    message.agentDid = (_object$agentDid3 = object.agentDid) !== null && _object$agentDid3 !== void 0 ? _object$agentDid3 : "";
    message.agentAddress = (_object$agentAddress3 = object.agentAddress) !== null && _object$agentAddress3 !== void 0 ? _object$agentAddress3 : "";
    message.disputeType = (_object$disputeType = object.disputeType) !== null && _object$disputeType !== void 0 ? _object$disputeType : 0;
    message.data = object.data !== undefined && object.data !== null ? DisputeData.fromPartial(object.data) : undefined;
    return message;
  }
};
function createBaseMsgDisputeClaimResponse() {
  return {};
}
export const MsgDisputeClaimResponse = {
  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 = createBaseMsgDisputeClaimResponse();
    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 = createBaseMsgDisputeClaimResponse();
    return message;
  }
};
function createBaseMsgWithdrawPayment() {
  return {
    claimId: "",
    inputs: [],
    outputs: [],
    paymentType: 0,
    contract_1155Payment: undefined,
    toAddress: "",
    fromAddress: "",
    releaseDate: undefined,
    adminAddress: "",
    cw20Payment: [],
    cw1155Payment: []
  };
}
export const MsgWithdrawPayment = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.claimId !== "") {
      writer.uint32(10).string(message.claimId);
    }
    for (const v of message.inputs) {
      Input.encode(v, writer.uint32(18).fork()).ldelim();
    }
    for (const v of message.outputs) {
      Output.encode(v, writer.uint32(26).fork()).ldelim();
    }
    if (message.paymentType !== 0) {
      writer.uint32(32).int32(message.paymentType);
    }
    if (message.contract_1155Payment !== undefined) {
      Contract1155Payment.encode(message.contract_1155Payment, writer.uint32(42).fork()).ldelim();
    }
    if (message.toAddress !== "") {
      writer.uint32(50).string(message.toAddress);
    }
    if (message.fromAddress !== "") {
      writer.uint32(58).string(message.fromAddress);
    }
    if (message.releaseDate !== undefined) {
      Timestamp.encode(message.releaseDate, writer.uint32(66).fork()).ldelim();
    }
    if (message.adminAddress !== "") {
      writer.uint32(74).string(message.adminAddress);
    }
    for (const v of message.cw20Payment) {
      CW20Payment.encode(v, writer.uint32(82).fork()).ldelim();
    }
    for (const v of message.cw1155Payment) {
      CW1155Payment.encode(v, writer.uint32(90).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 = createBaseMsgWithdrawPayment();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.claimId = reader.string();
          break;
        case 2:
          message.inputs.push(Input.decode(reader, reader.uint32()));
          break;
        case 3:
          message.outputs.push(Output.decode(reader, reader.uint32()));
          break;
        case 4:
          message.paymentType = reader.int32();
          break;
        case 5:
          message.contract_1155Payment = Contract1155Payment.decode(reader, reader.uint32());
          break;
        case 6:
          message.toAddress = reader.string();
          break;
        case 7:
          message.fromAddress = reader.string();
          break;
        case 8:
          message.releaseDate = Timestamp.decode(reader, reader.uint32());
          break;
        case 9:
          message.adminAddress = reader.string();
          break;
        case 10:
          message.cw20Payment.push(CW20Payment.decode(reader, reader.uint32()));
          break;
        case 11:
          message.cw1155Payment.push(CW1155Payment.decode(reader, reader.uint32()));
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      claimId: isSet(object.claimId) ? String(object.claimId) : "",
      inputs: Array.isArray(object === null || object === void 0 ? void 0 : object.inputs) ? object.inputs.map(e => Input.fromJSON(e)) : [],
      outputs: Array.isArray(object === null || object === void 0 ? void 0 : object.outputs) ? object.outputs.map(e => Output.fromJSON(e)) : [],
      paymentType: isSet(object.paymentType) ? paymentTypeFromJSON(object.paymentType) : 0,
      contract_1155Payment: isSet(object.contract_1155Payment) ? Contract1155Payment.fromJSON(object.contract_1155Payment) : undefined,
      toAddress: isSet(object.toAddress) ? String(object.toAddress) : "",
      fromAddress: isSet(object.fromAddress) ? String(object.fromAddress) : "",
      releaseDate: isSet(object.releaseDate) ? fromJsonTimestamp(object.releaseDate) : undefined,
      adminAddress: isSet(object.adminAddress) ? String(object.adminAddress) : "",
      cw20Payment: Array.isArray(object === null || object === void 0 ? void 0 : object.cw20Payment) ? object.cw20Payment.map(e => CW20Payment.fromJSON(e)) : [],
      cw1155Payment: Array.isArray(object === null || object === void 0 ? void 0 : object.cw1155Payment) ? object.cw1155Payment.map(e => CW1155Payment.fromJSON(e)) : []
    };
  },
  toJSON(message) {
    const obj = {};
    message.claimId !== undefined && (obj.claimId = message.claimId);
    if (message.inputs) {
      obj.inputs = message.inputs.map(e => e ? Input.toJSON(e) : undefined);
    } else {
      obj.inputs = [];
    }
    if (message.outputs) {
      obj.outputs = message.outputs.map(e => e ? Output.toJSON(e) : undefined);
    } else {
      obj.outputs = [];
    }
    message.paymentType !== undefined && (obj.paymentType = paymentTypeToJSON(message.paymentType));
    message.contract_1155Payment !== undefined && (obj.contract_1155Payment = message.contract_1155Payment ? Contract1155Payment.toJSON(message.contract_1155Payment) : undefined);
    message.toAddress !== undefined && (obj.toAddress = message.toAddress);
    message.fromAddress !== undefined && (obj.fromAddress = message.fromAddress);
    message.releaseDate !== undefined && (obj.releaseDate = fromTimestamp(message.releaseDate).toISOString());
    message.adminAddress !== undefined && (obj.adminAddress = message.adminAddress);
    if (message.cw20Payment) {
      obj.cw20Payment = message.cw20Payment.map(e => e ? CW20Payment.toJSON(e) : undefined);
    } else {
      obj.cw20Payment = [];
    }
    if (message.cw1155Payment) {
      obj.cw1155Payment = message.cw1155Payment.map(e => e ? CW1155Payment.toJSON(e) : undefined);
    } else {
      obj.cw1155Payment = [];
    }
    return obj;
  },
  fromPartial(object) {
    var _object$claimId3, _object$inputs, _object$outputs, _object$paymentType, _object$toAddress, _object$fromAddress, _object$adminAddress3, _object$cw20Payment3, _object$cw1155Payment3;
    const message = createBaseMsgWithdrawPayment();
    message.claimId = (_object$claimId3 = object.claimId) !== null && _object$claimId3 !== void 0 ? _object$claimId3 : "";
    message.inputs = ((_object$inputs = object.inputs) === null || _object$inputs === void 0 ? void 0 : _object$inputs.map(e => Input.fromPartial(e))) || [];
    message.outputs = ((_object$outputs = object.outputs) === null || _object$outputs === void 0 ? void 0 : _object$outputs.map(e => Output.fromPartial(e))) || [];
    message.paymentType = (_object$paymentType = object.paymentType) !== null && _object$paymentType !== void 0 ? _object$paymentType : 0;
    message.contract_1155Payment = object.contract_1155Payment !== undefined && object.contract_1155Payment !== null ? Contract1155Payment.fromPartial(object.contract_1155Payment) : undefined;
    message.toAddress = (_object$toAddress = object.toAddress) !== null && _object$toAddress !== void 0 ? _object$toAddress : "";
    message.fromAddress = (_object$fromAddress = object.fromAddress) !== null && _object$fromAddress !== void 0 ? _object$fromAddress : "";
    message.releaseDate = object.releaseDate !== undefined && object.releaseDate !== null ? Timestamp.fromPartial(object.releaseDate) : undefined;
    message.adminAddress = (_object$adminAddress3 = object.adminAddress) !== null && _object$adminAddress3 !== void 0 ? _object$adminAddress3 : "";
    message.cw20Payment = ((_object$cw20Payment3 = object.cw20Payment) === null || _object$cw20Payment3 === void 0 ? void 0 : _object$cw20Payment3.map(e => CW20Payment.fromPartial(e))) || [];
    message.cw1155Payment = ((_object$cw1155Payment3 = object.cw1155Payment) === null || _object$cw1155Payment3 === void 0 ? void 0 : _object$cw1155Payment3.map(e => CW1155Payment.fromPartial(e))) || [];
    return message;
  }
};
function createBaseMsgWithdrawPaymentResponse() {
  return {};
}
export const MsgWithdrawPaymentResponse = {
  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 = createBaseMsgWithdrawPaymentResponse();
    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 = createBaseMsgWithdrawPaymentResponse();
    return message;
  }
};
function createBaseMsgUpdateCollectionState() {
  return {
    collectionId: "",
    state: 0,
    adminAddress: ""
  };
}
export const MsgUpdateCollectionState = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.collectionId !== "") {
      writer.uint32(10).string(message.collectionId);
    }
    if (message.state !== 0) {
      writer.uint32(16).int32(message.state);
    }
    if (message.adminAddress !== "") {
      writer.uint32(26).string(message.adminAddress);
    }
    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 = createBaseMsgUpdateCollectionState();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.collectionId = reader.string();
          break;
        case 2:
          message.state = reader.int32();
          break;
        case 3:
          message.adminAddress = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      collectionId: isSet(object.collectionId) ? String(object.collectionId) : "",
      state: isSet(object.state) ? collectionStateFromJSON(object.state) : 0,
      adminAddress: isSet(object.adminAddress) ? String(object.adminAddress) : ""
    };
  },
  toJSON(message) {
    const obj = {};
    message.collectionId !== undefined && (obj.collectionId = message.collectionId);
    message.state !== undefined && (obj.state = collectionStateToJSON(message.state));
    message.adminAddress !== undefined && (obj.adminAddress = message.adminAddress);
    return obj;
  },
  fromPartial(object) {
    var _object$collectionId3, _object$state2, _object$adminAddress4;
    const message = createBaseMsgUpdateCollectionState();
    message.collectionId = (_object$collectionId3 = object.collectionId) !== null && _object$collectionId3 !== void 0 ? _object$collectionId3 : "";
    message.state = (_object$state2 = object.state) !== null && _object$state2 !== void 0 ? _object$state2 : 0;
    message.adminAddress = (_object$adminAddress4 = object.adminAddress) !== null && _object$adminAddress4 !== void 0 ? _object$adminAddress4 : "";
    return message;
  }
};
function createBaseMsgUpdateCollectionStateResponse() {
  return {};
}
export const MsgUpdateCollectionStateResponse = {
  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 = createBaseMsgUpdateCollectionStateResponse();
    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 = createBaseMsgUpdateCollectionStateResponse();
    return message;
  }
};
function createBaseMsgUpdateCollectionDates() {
  return {
    collectionId: "",
    startDate: undefined,
    endDate: undefined,
    adminAddress: ""
  };
}
export const MsgUpdateCollectionDates = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.collectionId !== "") {
      writer.uint32(10).string(message.collectionId);
    }
    if (message.startDate !== undefined) {
      Timestamp.encode(message.startDate, writer.uint32(18).fork()).ldelim();
    }
    if (message.endDate !== undefined) {
      Timestamp.encode(message.endDate, writer.uint32(26).fork()).ldelim();
    }
    if (message.adminAddress !== "") {
      writer.uint32(34).string(message.adminAddress);
    }
    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 = createBaseMsgUpdateCollectionDates();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.collectionId = reader.string();
          break;
        case 2:
          message.startDate = Timestamp.decode(reader, reader.uint32());
          break;
        case 3:
          message.endDate = Timestamp.decode(reader, reader.uint32());
          break;
        case 4:
          message.adminAddress = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      collectionId: isSet(object.collectionId) ? String(object.collectionId) : "",
      startDate: isSet(object.startDate) ? fromJsonTimestamp(object.startDate) : undefined,
      endDate: isSet(object.endDate) ? fromJsonTimestamp(object.endDate) : undefined,
      adminAddress: isSet(object.adminAddress) ? String(object.adminAddress) : ""
    };
  },
  toJSON(message) {
    const obj = {};
    message.collectionId !== undefined && (obj.collectionId = message.collectionId);
    message.startDate !== undefined && (obj.startDate = fromTimestamp(message.startDate).toISOString());
    message.endDate !== undefined && (obj.endDate = fromTimestamp(message.endDate).toISOString());
    message.adminAddress !== undefined && (obj.adminAddress = message.adminAddress);
    return obj;
  },
  fromPartial(object) {
    var _object$collectionId4, _object$adminAddress5;
    const message = createBaseMsgUpdateCollectionDates();
    message.collectionId = (_object$collectionId4 = object.collectionId) !== null && _object$collectionId4 !== void 0 ? _object$collectionId4 : "";
    message.startDate = object.startDate !== undefined && object.startDate !== null ? Timestamp.fromPartial(object.startDate) : undefined;
    message.endDate = object.endDate !== undefined && object.endDate !== null ? Timestamp.fromPartial(object.endDate) : undefined;
    message.adminAddress = (_object$adminAddress5 = object.adminAddress) !== null && _object$adminAddress5 !== void 0 ? _object$adminAddress5 : "";
    return message;
  }
};
function createBaseMsgUpdateCollectionDatesResponse() {
  return {};
}
export const MsgUpdateCollectionDatesResponse = {
  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 = createBaseMsgUpdateCollectionDatesResponse();
    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 = createBaseMsgUpdateCollectionDatesResponse();
    return message;
  }
};
function createBaseMsgUpdateCollectionPayments() {
  return {
    collectionId: "",
    payments: undefined,
    adminAddress: ""
  };
}
export const MsgUpdateCollectionPayments = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.collectionId !== "") {
      writer.uint32(10).string(message.collectionId);
    }
    if (message.payments !== undefined) {
      Payments.encode(message.payments, writer.uint32(18).fork()).ldelim();
    }
    if (message.adminAddress !== "") {
      writer.uint32(26).string(message.adminAddress);
    }
    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 = createBaseMsgUpdateCollectionPayments();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.collectionId = reader.string();
          break;
        case 2:
          message.payments = Payments.decode(reader, reader.uint32());
          break;
        case 3:
          message.adminAddress = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      collectionId: isSet(object.collectionId) ? String(object.collectionId) : "",
      payments: isSet(object.payments) ? Payments.fromJSON(object.payments) : undefined,
      adminAddress: isSet(object.adminAddress) ? String(object.adminAddress) : ""
    };
  },
  toJSON(message) {
    const obj = {};
    message.collectionId !== undefined && (obj.collectionId = message.collectionId);
    message.payments !== undefined && (obj.payments = message.payments ? Payments.toJSON(message.payments) : undefined);
    message.adminAddress !== undefined && (obj.adminAddress = message.adminAddress);
    return obj;
  },
  fromPartial(object) {
    var _object$collectionId5, _object$adminAddress6;
    const message = createBaseMsgUpdateCollectionPayments();
    message.collectionId = (_object$collectionId5 = object.collectionId) !== null && _object$collectionId5 !== void 0 ? _object$collectionId5 : "";
    message.payments = object.payments !== undefined && object.payments !== null ? Payments.fromPartial(object.payments) : undefined;
    message.adminAddress = (_object$adminAddress6 = object.adminAddress) !== null && _object$adminAddress6 !== void 0 ? _object$adminAddress6 : "";
    return message;
  }
};
function createBaseMsgUpdateCollectionPaymentsResponse() {
  return {};
}
export const MsgUpdateCollectionPaymentsResponse = {
  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 = createBaseMsgUpdateCollectionPaymentsResponse();
    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 = createBaseMsgUpdateCollectionPaymentsResponse();
    return message;
  }
};
function createBaseMsgUpdateCollectionIntents() {
  return {
    collectionId: "",
    intents: 0,
    adminAddress: ""
  };
}
export const MsgUpdateCollectionIntents = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.collectionId !== "") {
      writer.uint32(10).string(message.collectionId);
    }
    if (message.intents !== 0) {
      writer.uint32(16).int32(message.intents);
    }
    if (message.adminAddress !== "") {
      writer.uint32(26).string(message.adminAddress);
    }
    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 = createBaseMsgUpdateCollectionIntents();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.collectionId = reader.string();
          break;
        case 2:
          message.intents = reader.int32();
          break;
        case 3:
          message.adminAddress = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      collectionId: isSet(object.collectionId) ? String(object.collectionId) : "",
      intents: isSet(object.intents) ? collectionIntentOptionsFromJSON(object.intents) : 0,
      adminAddress: isSet(object.adminAddress) ? String(object.adminAddress) : ""
    };
  },
  toJSON(message) {
    const obj = {};
    message.collectionId !== undefined && (obj.collectionId = message.collectionId);
    message.intents !== undefined && (obj.intents = collectionIntentOptionsToJSON(message.intents));
    message.adminAddress !== undefined && (obj.adminAddress = message.adminAddress);
    return obj;
  },
  fromPartial(object) {
    var _object$collectionId6, _object$intents2, _object$adminAddress7;
    const message = createBaseMsgUpdateCollectionIntents();
    message.collectionId = (_object$collectionId6 = object.collectionId) !== null && _object$collectionId6 !== void 0 ? _object$collectionId6 : "";
    message.intents = (_object$intents2 = object.intents) !== null && _object$intents2 !== void 0 ? _object$intents2 : 0;
    message.adminAddress = (_object$adminAddress7 = object.adminAddress) !== null && _object$adminAddress7 !== void 0 ? _object$adminAddress7 : "";
    return message;
  }
};
function createBaseMsgUpdateCollectionIntentsResponse() {
  return {};
}
export const MsgUpdateCollectionIntentsResponse = {
  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 = createBaseMsgUpdateCollectionIntentsResponse();
    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 = createBaseMsgUpdateCollectionIntentsResponse();
    return message;
  }
};
function createBaseMsgClaimIntent() {
  return {
    agentDid: "",
    agentAddress: "",
    collectionId: "",
    amount: [],
    cw20Payment: [],
    cw1155Payment: []
  };
}
export const MsgClaimIntent = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.agentDid !== "") {
      writer.uint32(10).string(message.agentDid);
    }
    if (message.agentAddress !== "") {
      writer.uint32(18).string(message.agentAddress);
    }
    if (message.collectionId !== "") {
      writer.uint32(26).string(message.collectionId);
    }
    for (const v of message.amount) {
      Coin.encode(v, writer.uint32(34).fork()).ldelim();
    }
    for (const v of message.cw20Payment) {
      CW20Payment.encode(v, writer.uint32(42).fork()).ldelim();
    }
    for (const v of message.cw1155Payment) {
      CW1155Payment.encode(v, 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 = createBaseMsgClaimIntent();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.agentDid = reader.string();
          break;
        case 2:
          message.agentAddress = reader.string();
          break;
        case 3:
          message.collectionId = reader.string();
          break;
        case 4:
          message.amount.push(Coin.decode(reader, reader.uint32()));
          break;
        case 5:
          message.cw20Payment.push(CW20Payment.decode(reader, reader.uint32()));
          break;
        case 6:
          message.cw1155Payment.push(CW1155Payment.decode(reader, reader.uint32()));
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      agentDid: isSet(object.agentDid) ? String(object.agentDid) : "",
      agentAddress: isSet(object.agentAddress) ? String(object.agentAddress) : "",
      collectionId: isSet(object.collectionId) ? String(object.collectionId) : "",
      amount: Array.isArray(object === null || object === void 0 ? void 0 : object.amount) ? object.amount.map(e => Coin.fromJSON(e)) : [],
      cw20Payment: Array.isArray(object === null || object === void 0 ? void 0 : object.cw20Payment) ? object.cw20Payment.map(e => CW20Payment.fromJSON(e)) : [],
      cw1155Payment: Array.isArray(object === null || object === void 0 ? void 0 : object.cw1155Payment) ? object.cw1155Payment.map(e => CW1155Payment.fromJSON(e)) : []
    };
  },
  toJSON(message) {
    const obj = {};
    message.agentDid !== undefined && (obj.agentDid = message.agentDid);
    message.agentAddress !== undefined && (obj.agentAddress = message.agentAddress);
    message.collectionId !== undefined && (obj.collectionId = message.collectionId);
    if (message.amount) {
      obj.amount = message.amount.map(e => e ? Coin.toJSON(e) : undefined);
    } else {
      obj.amount = [];
    }
    if (message.cw20Payment) {
      obj.cw20Payment = message.cw20Payment.map(e => e ? CW20Payment.toJSON(e) : undefined);
    } else {
      obj.cw20Payment = [];
    }
    if (message.cw1155Payment) {
      obj.cw1155Payment = message.cw1155Payment.map(e => e ? CW1155Payment.toJSON(e) : undefined);
    } else {
      obj.cw1155Payment = [];
    }
    return obj;
  },
  fromPartial(object) {
    var _object$agentDid4, _object$agentAddress4, _object$collectionId7, _object$amount3, _object$cw20Payment4, _object$cw1155Payment4;
    const message = createBaseMsgClaimIntent();
    message.agentDid = (_object$agentDid4 = object.agentDid) !== null && _object$agentDid4 !== void 0 ? _object$agentDid4 : "";
    message.agentAddress = (_object$agentAddress4 = object.agentAddress) !== null && _object$agentAddress4 !== void 0 ? _object$agentAddress4 : "";
    message.collectionId = (_object$collectionId7 = object.collectionId) !== null && _object$collectionId7 !== void 0 ? _object$collectionId7 : "";
    message.amount = ((_object$amount3 = object.amount) === null || _object$amount3 === void 0 ? void 0 : _object$amount3.map(e => Coin.fromPartial(e))) || [];
    message.cw20Payment = ((_object$cw20Payment4 = object.cw20Payment) === null || _object$cw20Payment4 === void 0 ? void 0 : _object$cw20Payment4.map(e => CW20Payment.fromPartial(e))) || [];
    message.cw1155Payment = ((_object$cw1155Payment4 = object.cw1155Payment) === null || _object$cw1155Payment4 === void 0 ? void 0 : _object$cw1155Payment4.map(e => CW1155Payment.fromPartial(e))) || [];
    return message;
  }
};
function createBaseMsgClaimIntentResponse() {
  return {
    intentId: "",
    expireAt: undefined
  };
}
export const MsgClaimIntentResponse = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.intentId !== "") {
      writer.uint32(10).string(message.intentId);
    }
    if (message.expireAt !== undefined) {
      Timestamp.encode(message.expireAt, 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 = createBaseMsgClaimIntentResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.intentId = reader.string();
          break;
        case 2:
          message.expireAt = Timestamp.decode(reader, reader.uint32());
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      intentId: isSet(object.intentId) ? String(object.intentId) : "",
      expireAt: isSet(object.expireAt) ? fromJsonTimestamp(object.expireAt) : undefined
    };
  },
  toJSON(message) {
    const obj = {};
    message.intentId !== undefined && (obj.intentId = message.intentId);
    message.expireAt !== undefined && (obj.expireAt = fromTimestamp(message.expireAt).toISOString());
    return obj;
  },
  fromPartial(object) {
    var _object$intentId;
    const message = createBaseMsgClaimIntentResponse();
    message.intentId = (_object$intentId = object.intentId) !== null && _object$intentId !== void 0 ? _object$intentId : "";
    message.expireAt = object.expireAt !== undefined && object.expireAt !== null ? Timestamp.fromPartial(object.expireAt) : undefined;
    return message;
  }
};
function createBaseMsgCreateClaimAuthorization() {
  return {
    creatorAddress: "",
    creatorDid: "",
    granteeAddress: "",
    adminAddress: "",
    collectionId: "",
    authType: 0,
    agentQuota: Long.UZERO,
    maxAmount: [],
    maxCw20Payment: [],
    expiration: undefined,
    intentDurationNs: undefined,
    beforeDate: undefined,
    maxCw1155Payment: []
  };
}
export const MsgCreateClaimAuthorization = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.creatorAddress !== "") {
      writer.uint32(10).string(message.creatorAddress);
    }
    if (message.creatorDid !== "") {
      writer.uint32(18).string(message.creatorDid);
    }
    if (message.granteeAddress !== "") {
      writer.uint32(26).string(message.granteeAddress);
    }
    if (message.adminAddress !== "") {
      writer.uint32(34).string(message.adminAddress);
    }
    if (message.collectionId !== "") {
      writer.uint32(42).string(message.collectionId);
    }
    if (message.authType !== 0) {
      writer.uint32(48).int32(message.authType);
    }
    if (!message.agentQuota.isZero()) {
      writer.uint32(56).uint64(message.agentQuota);
    }
    for (const v of message.maxAmount) {
      Coin.encode(v, writer.uint32(66).fork()).ldelim();
    }
    for (const v of message.maxCw20Payment) {
      CW20Payment.encode(v, writer.uint32(74).fork()).ldelim();
    }
    if (message.expiration !== undefined) {
      Timestamp.encode(message.expiration, writer.uint32(82).fork()).ldelim();
    }
    if (message.intentDurationNs !== undefined) {
      Duration.encode(message.intentDurationNs, writer.uint32(90).fork()).ldelim();
    }
    if (message.beforeDate !== undefined) {
      Timestamp.encode(message.beforeDate, writer.uint32(98).fork()).ldelim();
    }
    for (const v of message.maxCw1155Payment) {
      CW1155Payment.encode(v, writer.uint32(106).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 = createBaseMsgCreateClaimAuthorization();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.creatorAddress = reader.string();
          break;
        case 2:
          message.creatorDid = reader.string();
          break;
        case 3:
          message.granteeAddress = reader.string();
          break;
        case 4:
          message.adminAddress = reader.string();
          break;
        case 5:
          message.collectionId = reader.string();
          break;
        case 6:
          message.authType = reader.int32();
          break;
        case 7:
          message.agentQuota = reader.uint64();
          break;
        case 8:
          message.maxAmount.push(Coin.decode(reader, reader.uint32()));
          break;
        case 9:
          message.maxCw20Payment.push(CW20Payment.decode(reader, reader.uint32()));
          break;
        case 10:
          message.expiration = Timestamp.decode(reader, reader.uint32());
          break;
        case 11:
          message.intentDurationNs = Duration.decode(reader, reader.uint32());
          break;
        case 12:
          message.beforeDate = Timestamp.decode(reader, reader.uint32());
          break;
        case 13:
          message.maxCw1155Payment.push(CW1155Payment.decode(reader, reader.uint32()));
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      creatorAddress: isSet(object.creatorAddress) ? String(object.creatorAddress) : "",
      creatorDid: isSet(object.creatorDid) ? String(object.creatorDid) : "",
      granteeAddress: isSet(object.granteeAddress) ? String(object.granteeAddress) : "",
      adminAddress: isSet(object.adminAddress) ? String(object.adminAddress) : "",
      collectionId: isSet(object.collectionId) ? String(object.collectionId) : "",
      authType: isSet(object.authType) ? createClaimAuthorizationTypeFromJSON(object.authType) : 0,
      agentQuota: isSet(object.agentQuota) ? Long.fromValue(object.agentQuota) : Long.UZERO,
      maxAmount: Array.isArray(object === null || object === void 0 ? void 0 : object.maxAmount) ? object.maxAmount.map(e => Coin.fromJSON(e)) : [],
      maxCw20Payment: Array.isArray(object === null || object === void 0 ? void 0 : object.maxCw20Payment) ? object.maxCw20Payment.map(e => CW20Payment.fromJSON(e)) : [],
      expiration: isSet(object.expiration) ? fromJsonTimestamp(object.expiration) : undefined,
      intentDurationNs: isSet(object.intentDurationNs) ? Duration.fromJSON(object.intentDurationNs) : undefined,
      beforeDate: isSet(object.beforeDate) ? fromJsonTimestamp(object.beforeDate) : undefined,
      maxCw1155Payment: Array.isArray(object === null || object === void 0 ? void 0 : object.maxCw1155Payment) ? object.maxCw1155Payment.map(e => CW1155Payment.fromJSON(e)) : []
    };
  },
  toJSON(message) {
    const obj = {};
    message.creatorAddress !== undefined && (obj.creatorAddress = message.creatorAddress);
    message.creatorDid !== undefined && (obj.creatorDid = message.creatorDid);
    message.granteeAddress !== undefined && (obj.granteeAddress = message.granteeAddress);
    message.adminAddress !== undefined && (obj.adminAddress = message.adminAddress);
    message.collectionId !== undefined && (obj.collectionId = message.collectionId);
    message.authType !== undefined && (obj.authType = createClaimAuthorizationTypeToJSON(message.authType));
    message.agentQuota !== undefined && (obj.agentQuota = (message.agentQuota || Long.UZERO).toString());
    if (message.maxAmount) {
      obj.maxAmount = message.maxAmount.map(e => e ? Coin.toJSON(e) : undefined);
    } else {
      obj.maxAmount = [];
    }
    if (message.maxCw20Payment) {
      obj.maxCw20Payment = message.maxCw20Payment.map(e => e ? CW20Payment.toJSON(e) : undefined);
    } else {
      obj.maxCw20Payment = [];
    }
    message.expiration !== undefined && (obj.expiration = fromTimestamp(message.expiration).toISOString());
    message.intentDurationNs !== undefined && (obj.intentDurationNs = message.intentDurationNs ? Duration.toJSON(message.intentDurationNs) : undefined);
    message.beforeDate !== undefined && (obj.beforeDate = fromTimestamp(message.beforeDate).toISOString());
    if (message.maxCw1155Payment) {
      obj.maxCw1155Payment = message.maxCw1155Payment.map(e => e ? CW1155Payment.toJSON(e) : undefined);
    } else {
      obj.maxCw1155Payment = [];
    }
    return obj;
  },
  fromPartial(object) {
    var _object$creatorAddres, _object$creatorDid, _object$granteeAddres, _object$adminAddress8, _object$collectionId8, _object$authType, _object$maxAmount, _object$maxCw20Paymen, _object$maxCw1155Paym;
    const message = createBaseMsgCreateClaimAuthorization();
    message.creatorAddress = (_object$creatorAddres = object.creatorAddress) !== null && _object$creatorAddres !== void 0 ? _object$creatorAddres : "";
    message.creatorDid = (_object$creatorDid = object.creatorDid) !== null && _object$creatorDid !== void 0 ? _object$creatorDid : "";
    message.granteeAddress = (_object$granteeAddres = object.granteeAddress) !== null && _object$granteeAddres !== void 0 ? _object$granteeAddres : "";
    message.adminAddress = (_object$adminAddress8 = object.adminAddress) !== null && _object$adminAddress8 !== void 0 ? _object$adminAddress8 : "";
    message.collectionId = (_object$collectionId8 = object.collectionId) !== null && _object$collectionId8 !== void 0 ? _object$collectionId8 : "";
    message.authType = (_object$authType = object.authType) !== null && _object$authType !== void 0 ? _object$authType : 0;
    message.agentQuota = object.agentQuota !== undefined && object.agentQuota !== null ? Long.fromValue(object.agentQuota) : Long.UZERO;
    message.maxAmount = ((_object$maxAmount = object.maxAmount) === null || _object$maxAmount === void 0 ? void 0 : _object$maxAmount.map(e => Coin.fromPartial(e))) || [];
    message.maxCw20Payment = ((_object$maxCw20Paymen = object.maxCw20Payment) === null || _object$maxCw20Paymen === void 0 ? void 0 : _object$maxCw20Paymen.map(e => CW20Payment.fromPartial(e))) || [];
    message.expiration = object.expiration !== undefined && object.expiration !== null ? Timestamp.fromPartial(object.expiration) : undefined;
    message.intentDurationNs = object.intentDurationNs !== undefined && object.intentDurationNs !== null ? Duration.fromPartial(object.intentDurationNs) : undefined;
    message.beforeDate = object.beforeDate !== undefined && object.beforeDate !== null ? Timestamp.fromPartial(object.beforeDate) : undefined;
    message.maxCw1155Payment = ((_object$maxCw1155Paym = object.maxCw1155Payment) === null || _object$maxCw1155Paym === void 0 ? void 0 : _object$maxCw1155Paym.map(e => CW1155Payment.fromPartial(e))) || [];
    return message;
  }
};
function createBaseMsgCreateClaimAuthorizationResponse() {
  return {};
}
export const MsgCreateClaimAuthorizationResponse = {
  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 = createBaseMsgCreateClaimAuthorizationResponse();
    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 = createBaseMsgCreateClaimAuthorizationResponse();
    return message;
  }
};