//@ts-nocheck
import { Timestamp } from "../../../google/protobuf/timestamp";
import { Coin } from "../../../cosmos/base/v1beta1/coin";
import { Duration } from "../../../google/protobuf/duration";
import { Long, isSet, fromJsonTimestamp, fromTimestamp } from "../../../helpers";
import * as _m0 from "protobufjs/minimal";
export let CollectionState = /*#__PURE__*/function (CollectionState) {
  CollectionState[CollectionState["OPEN"] = 0] = "OPEN";
  CollectionState[CollectionState["PAUSED"] = 1] = "PAUSED";
  CollectionState[CollectionState["CLOSED"] = 2] = "CLOSED";
  CollectionState[CollectionState["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
  return CollectionState;
}({});
export const CollectionStateSDKType = CollectionState;
export function collectionStateFromJSON(object) {
  switch (object) {
    case 0:
    case "OPEN":
      return CollectionState.OPEN;
    case 1:
    case "PAUSED":
      return CollectionState.PAUSED;
    case 2:
    case "CLOSED":
      return CollectionState.CLOSED;
    case -1:
    case "UNRECOGNIZED":
    default:
      return CollectionState.UNRECOGNIZED;
  }
}
export function collectionStateToJSON(object) {
  switch (object) {
    case CollectionState.OPEN:
      return "OPEN";
    case CollectionState.PAUSED:
      return "PAUSED";
    case CollectionState.CLOSED:
      return "CLOSED";
    case CollectionState.UNRECOGNIZED:
    default:
      return "UNRECOGNIZED";
  }
}
export let CollectionIntentOptions = /*#__PURE__*/function (CollectionIntentOptions) {
  /**
   * ALLOW - Allow: Intents can be made for claims, but claims can also be made without
   * intents.
   */
  CollectionIntentOptions[CollectionIntentOptions["ALLOW"] = 0] = "ALLOW";
  /** DENY - Deny: Intents cannot be made for claims for the collection. */
  CollectionIntentOptions[CollectionIntentOptions["DENY"] = 1] = "DENY";
  /**
   * REQUIRED - Required: Claims cannot be made without an associated intent. An intent is
   * mandatory before a claim can be submitted.
   */
  CollectionIntentOptions[CollectionIntentOptions["REQUIRED"] = 2] = "REQUIRED";
  CollectionIntentOptions[CollectionIntentOptions["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
  return CollectionIntentOptions;
}({});
export const CollectionIntentOptionsSDKType = CollectionIntentOptions;
export function collectionIntentOptionsFromJSON(object) {
  switch (object) {
    case 0:
    case "ALLOW":
      return CollectionIntentOptions.ALLOW;
    case 1:
    case "DENY":
      return CollectionIntentOptions.DENY;
    case 2:
    case "REQUIRED":
      return CollectionIntentOptions.REQUIRED;
    case -1:
    case "UNRECOGNIZED":
    default:
      return CollectionIntentOptions.UNRECOGNIZED;
  }
}
export function collectionIntentOptionsToJSON(object) {
  switch (object) {
    case CollectionIntentOptions.ALLOW:
      return "ALLOW";
    case CollectionIntentOptions.DENY:
      return "DENY";
    case CollectionIntentOptions.REQUIRED:
      return "REQUIRED";
    case CollectionIntentOptions.UNRECOGNIZED:
    default:
      return "UNRECOGNIZED";
  }
}
export let EvaluationStatus = /*#__PURE__*/function (EvaluationStatus) {
  EvaluationStatus[EvaluationStatus["PENDING"] = 0] = "PENDING";
  EvaluationStatus[EvaluationStatus["APPROVED"] = 1] = "APPROVED";
  EvaluationStatus[EvaluationStatus["REJECTED"] = 2] = "REJECTED";
  EvaluationStatus[EvaluationStatus["DISPUTED"] = 3] = "DISPUTED";
  EvaluationStatus[EvaluationStatus["INVALIDATED"] = 4] = "INVALIDATED";
  EvaluationStatus[EvaluationStatus["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
  return EvaluationStatus;
}({});
export const EvaluationStatusSDKType = EvaluationStatus;
export function evaluationStatusFromJSON(object) {
  switch (object) {
    case 0:
    case "PENDING":
      return EvaluationStatus.PENDING;
    case 1:
    case "APPROVED":
      return EvaluationStatus.APPROVED;
    case 2:
    case "REJECTED":
      return EvaluationStatus.REJECTED;
    case 3:
    case "DISPUTED":
      return EvaluationStatus.DISPUTED;
    case 4:
    case "INVALIDATED":
      return EvaluationStatus.INVALIDATED;
    case -1:
    case "UNRECOGNIZED":
    default:
      return EvaluationStatus.UNRECOGNIZED;
  }
}
export function evaluationStatusToJSON(object) {
  switch (object) {
    case EvaluationStatus.PENDING:
      return "PENDING";
    case EvaluationStatus.APPROVED:
      return "APPROVED";
    case EvaluationStatus.REJECTED:
      return "REJECTED";
    case EvaluationStatus.DISPUTED:
      return "DISPUTED";
    case EvaluationStatus.INVALIDATED:
      return "INVALIDATED";
    case EvaluationStatus.UNRECOGNIZED:
    default:
      return "UNRECOGNIZED";
  }
}
export let IntentStatus = /*#__PURE__*/function (IntentStatus) {
  /**
   * ACTIVE - Active: Intent is created and active, payments have been transferred to
   * escrow if there is any
   */
  IntentStatus[IntentStatus["ACTIVE"] = 0] = "ACTIVE";
  /**
   * FULFILLED - Fulfilled: Intent is fulfilled, was used to create a claim and funds will
   * be released on claim APPROVAL, or funds will be reverted on claim REJECTION
   * or DISPUTE
   */
  IntentStatus[IntentStatus["FULFILLED"] = 1] = "FULFILLED";
  /**
   * EXPIRED - Expired: Intent has expired, payments have been transferred back out of
   * escrow
   */
  IntentStatus[IntentStatus["EXPIRED"] = 2] = "EXPIRED";
  IntentStatus[IntentStatus["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
  return IntentStatus;
}({});
export const IntentStatusSDKType = IntentStatus;
export function intentStatusFromJSON(object) {
  switch (object) {
    case 0:
    case "ACTIVE":
      return IntentStatus.ACTIVE;
    case 1:
    case "FULFILLED":
      return IntentStatus.FULFILLED;
    case 2:
    case "EXPIRED":
      return IntentStatus.EXPIRED;
    case -1:
    case "UNRECOGNIZED":
    default:
      return IntentStatus.UNRECOGNIZED;
  }
}
export function intentStatusToJSON(object) {
  switch (object) {
    case IntentStatus.ACTIVE:
      return "ACTIVE";
    case IntentStatus.FULFILLED:
      return "FULFILLED";
    case IntentStatus.EXPIRED:
      return "EXPIRED";
    case IntentStatus.UNRECOGNIZED:
    default:
      return "UNRECOGNIZED";
  }
}
export let PaymentType = /*#__PURE__*/function (PaymentType) {
  PaymentType[PaymentType["SUBMISSION"] = 0] = "SUBMISSION";
  PaymentType[PaymentType["APPROVAL"] = 1] = "APPROVAL";
  PaymentType[PaymentType["EVALUATION"] = 2] = "EVALUATION";
  PaymentType[PaymentType["REJECTION"] = 3] = "REJECTION";
  PaymentType[PaymentType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
  return PaymentType;
}({});
export const PaymentTypeSDKType = PaymentType;
export function paymentTypeFromJSON(object) {
  switch (object) {
    case 0:
    case "SUBMISSION":
      return PaymentType.SUBMISSION;
    case 1:
    case "APPROVAL":
      return PaymentType.APPROVAL;
    case 2:
    case "EVALUATION":
      return PaymentType.EVALUATION;
    case 3:
    case "REJECTION":
      return PaymentType.REJECTION;
    case -1:
    case "UNRECOGNIZED":
    default:
      return PaymentType.UNRECOGNIZED;
  }
}
export function paymentTypeToJSON(object) {
  switch (object) {
    case PaymentType.SUBMISSION:
      return "SUBMISSION";
    case PaymentType.APPROVAL:
      return "APPROVAL";
    case PaymentType.EVALUATION:
      return "EVALUATION";
    case PaymentType.REJECTION:
      return "REJECTION";
    case PaymentType.UNRECOGNIZED:
    default:
      return "UNRECOGNIZED";
  }
}
export let PaymentStatus = /*#__PURE__*/function (PaymentStatus) {
  PaymentStatus[PaymentStatus["NO_PAYMENT"] = 0] = "NO_PAYMENT";
  /** PROMISED - Promised: Agent is contracted to receive payment */
  PaymentStatus[PaymentStatus["PROMISED"] = 1] = "PROMISED";
  /** AUTHORIZED - Authorized: Authz set up, no guarantee */
  PaymentStatus[PaymentStatus["AUTHORIZED"] = 2] = "AUTHORIZED";
  /** GUARANTEED - Guaranteed: Escrow set up with funds blocked */
  PaymentStatus[PaymentStatus["GUARANTEED"] = 3] = "GUARANTEED";
  /** PAID - Paid: Funds have been paid */
  PaymentStatus[PaymentStatus["PAID"] = 4] = "PAID";
  /** FAILED - Failed: Payment failed, most probably due to insufficient funds */
  PaymentStatus[PaymentStatus["FAILED"] = 5] = "FAILED";
  /** DISPUTED_PAYMENT - DisputedPayment: Payment disputed */
  PaymentStatus[PaymentStatus["DISPUTED_PAYMENT"] = 6] = "DISPUTED_PAYMENT";
  PaymentStatus[PaymentStatus["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
  return PaymentStatus;
}({});
export const PaymentStatusSDKType = PaymentStatus;
export function paymentStatusFromJSON(object) {
  switch (object) {
    case 0:
    case "NO_PAYMENT":
      return PaymentStatus.NO_PAYMENT;
    case 1:
    case "PROMISED":
      return PaymentStatus.PROMISED;
    case 2:
    case "AUTHORIZED":
      return PaymentStatus.AUTHORIZED;
    case 3:
    case "GUARANTEED":
      return PaymentStatus.GUARANTEED;
    case 4:
    case "PAID":
      return PaymentStatus.PAID;
    case 5:
    case "FAILED":
      return PaymentStatus.FAILED;
    case 6:
    case "DISPUTED_PAYMENT":
      return PaymentStatus.DISPUTED_PAYMENT;
    case -1:
    case "UNRECOGNIZED":
    default:
      return PaymentStatus.UNRECOGNIZED;
  }
}
export function paymentStatusToJSON(object) {
  switch (object) {
    case PaymentStatus.NO_PAYMENT:
      return "NO_PAYMENT";
    case PaymentStatus.PROMISED:
      return "PROMISED";
    case PaymentStatus.AUTHORIZED:
      return "AUTHORIZED";
    case PaymentStatus.GUARANTEED:
      return "GUARANTEED";
    case PaymentStatus.PAID:
      return "PAID";
    case PaymentStatus.FAILED:
      return "FAILED";
    case PaymentStatus.DISPUTED_PAYMENT:
      return "DISPUTED_PAYMENT";
    case PaymentStatus.UNRECOGNIZED:
    default:
      return "UNRECOGNIZED";
  }
}

/** CW20Output represents a CW20 token output for split payments */

/** CW20Output represents a CW20 token output for split payments */

/** Intent defines the structure for a service agent's claim intent. */

/** Intent defines the structure for a service agent's claim intent. */

function createBaseParams() {
  return {
    collectionSequence: Long.UZERO,
    ixoAccount: "",
    networkFeePercentage: "",
    nodeFeePercentage: "",
    intentSequence: Long.UZERO
  };
}
export const Params = {
  encode(message, writer = _m0.Writer.create()) {
    if (!message.collectionSequence.isZero()) {
      writer.uint32(8).uint64(message.collectionSequence);
    }
    if (message.ixoAccount !== "") {
      writer.uint32(18).string(message.ixoAccount);
    }
    if (message.networkFeePercentage !== "") {
      writer.uint32(26).string(message.networkFeePercentage);
    }
    if (message.nodeFeePercentage !== "") {
      writer.uint32(34).string(message.nodeFeePercentage);
    }
    if (!message.intentSequence.isZero()) {
      writer.uint32(40).uint64(message.intentSequence);
    }
    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.collectionSequence = reader.uint64();
          break;
        case 2:
          message.ixoAccount = reader.string();
          break;
        case 3:
          message.networkFeePercentage = reader.string();
          break;
        case 4:
          message.nodeFeePercentage = reader.string();
          break;
        case 5:
          message.intentSequence = reader.uint64();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      collectionSequence: isSet(object.collectionSequence) ? Long.fromValue(object.collectionSequence) : Long.UZERO,
      ixoAccount: isSet(object.ixoAccount) ? String(object.ixoAccount) : "",
      networkFeePercentage: isSet(object.networkFeePercentage) ? String(object.networkFeePercentage) : "",
      nodeFeePercentage: isSet(object.nodeFeePercentage) ? String(object.nodeFeePercentage) : "",
      intentSequence: isSet(object.intentSequence) ? Long.fromValue(object.intentSequence) : Long.UZERO
    };
  },
  toJSON(message) {
    const obj = {};
    message.collectionSequence !== undefined && (obj.collectionSequence = (message.collectionSequence || Long.UZERO).toString());
    message.ixoAccount !== undefined && (obj.ixoAccount = message.ixoAccount);
    message.networkFeePercentage !== undefined && (obj.networkFeePercentage = message.networkFeePercentage);
    message.nodeFeePercentage !== undefined && (obj.nodeFeePercentage = message.nodeFeePercentage);
    message.intentSequence !== undefined && (obj.intentSequence = (message.intentSequence || Long.UZERO).toString());
    return obj;
  },
  fromPartial(object) {
    var _object$ixoAccount, _object$networkFeePer, _object$nodeFeePercen;
    const message = createBaseParams();
    message.collectionSequence = object.collectionSequence !== undefined && object.collectionSequence !== null ? Long.fromValue(object.collectionSequence) : Long.UZERO;
    message.ixoAccount = (_object$ixoAccount = object.ixoAccount) !== null && _object$ixoAccount !== void 0 ? _object$ixoAccount : "";
    message.networkFeePercentage = (_object$networkFeePer = object.networkFeePercentage) !== null && _object$networkFeePer !== void 0 ? _object$networkFeePer : "";
    message.nodeFeePercentage = (_object$nodeFeePercen = object.nodeFeePercentage) !== null && _object$nodeFeePercen !== void 0 ? _object$nodeFeePercen : "";
    message.intentSequence = object.intentSequence !== undefined && object.intentSequence !== null ? Long.fromValue(object.intentSequence) : Long.UZERO;
    return message;
  }
};
function createBaseCollection() {
  return {
    id: "",
    entity: "",
    admin: "",
    protocol: "",
    startDate: undefined,
    endDate: undefined,
    quota: Long.UZERO,
    count: Long.UZERO,
    evaluated: Long.UZERO,
    approved: Long.UZERO,
    rejected: Long.UZERO,
    disputed: Long.UZERO,
    state: 0,
    payments: undefined,
    signer: "",
    invalidated: Long.UZERO,
    escrowAccount: "",
    intents: 0
  };
}
export const Collection = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.id !== "") {
      writer.uint32(10).string(message.id);
    }
    if (message.entity !== "") {
      writer.uint32(18).string(message.entity);
    }
    if (message.admin !== "") {
      writer.uint32(26).string(message.admin);
    }
    if (message.protocol !== "") {
      writer.uint32(34).string(message.protocol);
    }
    if (message.startDate !== undefined) {
      Timestamp.encode(message.startDate, writer.uint32(42).fork()).ldelim();
    }
    if (message.endDate !== undefined) {
      Timestamp.encode(message.endDate, writer.uint32(50).fork()).ldelim();
    }
    if (!message.quota.isZero()) {
      writer.uint32(56).uint64(message.quota);
    }
    if (!message.count.isZero()) {
      writer.uint32(64).uint64(message.count);
    }
    if (!message.evaluated.isZero()) {
      writer.uint32(72).uint64(message.evaluated);
    }
    if (!message.approved.isZero()) {
      writer.uint32(80).uint64(message.approved);
    }
    if (!message.rejected.isZero()) {
      writer.uint32(88).uint64(message.rejected);
    }
    if (!message.disputed.isZero()) {
      writer.uint32(96).uint64(message.disputed);
    }
    if (message.state !== 0) {
      writer.uint32(104).int32(message.state);
    }
    if (message.payments !== undefined) {
      Payments.encode(message.payments, writer.uint32(114).fork()).ldelim();
    }
    if (message.signer !== "") {
      writer.uint32(122).string(message.signer);
    }
    if (!message.invalidated.isZero()) {
      writer.uint32(128).uint64(message.invalidated);
    }
    if (message.escrowAccount !== "") {
      writer.uint32(138).string(message.escrowAccount);
    }
    if (message.intents !== 0) {
      writer.uint32(144).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 = createBaseCollection();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.id = reader.string();
          break;
        case 2:
          message.entity = reader.string();
          break;
        case 3:
          message.admin = reader.string();
          break;
        case 4:
          message.protocol = reader.string();
          break;
        case 5:
          message.startDate = Timestamp.decode(reader, reader.uint32());
          break;
        case 6:
          message.endDate = Timestamp.decode(reader, reader.uint32());
          break;
        case 7:
          message.quota = reader.uint64();
          break;
        case 8:
          message.count = reader.uint64();
          break;
        case 9:
          message.evaluated = reader.uint64();
          break;
        case 10:
          message.approved = reader.uint64();
          break;
        case 11:
          message.rejected = reader.uint64();
          break;
        case 12:
          message.disputed = reader.uint64();
          break;
        case 13:
          message.state = reader.int32();
          break;
        case 14:
          message.payments = Payments.decode(reader, reader.uint32());
          break;
        case 15:
          message.signer = reader.string();
          break;
        case 16:
          message.invalidated = reader.uint64();
          break;
        case 17:
          message.escrowAccount = reader.string();
          break;
        case 18:
          message.intents = reader.int32();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      id: isSet(object.id) ? String(object.id) : "",
      entity: isSet(object.entity) ? String(object.entity) : "",
      admin: isSet(object.admin) ? String(object.admin) : "",
      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,
      count: isSet(object.count) ? Long.fromValue(object.count) : Long.UZERO,
      evaluated: isSet(object.evaluated) ? Long.fromValue(object.evaluated) : Long.UZERO,
      approved: isSet(object.approved) ? Long.fromValue(object.approved) : Long.UZERO,
      rejected: isSet(object.rejected) ? Long.fromValue(object.rejected) : Long.UZERO,
      disputed: isSet(object.disputed) ? Long.fromValue(object.disputed) : Long.UZERO,
      state: isSet(object.state) ? collectionStateFromJSON(object.state) : 0,
      payments: isSet(object.payments) ? Payments.fromJSON(object.payments) : undefined,
      signer: isSet(object.signer) ? String(object.signer) : "",
      invalidated: isSet(object.invalidated) ? Long.fromValue(object.invalidated) : Long.UZERO,
      escrowAccount: isSet(object.escrowAccount) ? String(object.escrowAccount) : "",
      intents: isSet(object.intents) ? collectionIntentOptionsFromJSON(object.intents) : 0
    };
  },
  toJSON(message) {
    const obj = {};
    message.id !== undefined && (obj.id = message.id);
    message.entity !== undefined && (obj.entity = message.entity);
    message.admin !== undefined && (obj.admin = message.admin);
    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.count !== undefined && (obj.count = (message.count || Long.UZERO).toString());
    message.evaluated !== undefined && (obj.evaluated = (message.evaluated || Long.UZERO).toString());
    message.approved !== undefined && (obj.approved = (message.approved || Long.UZERO).toString());
    message.rejected !== undefined && (obj.rejected = (message.rejected || Long.UZERO).toString());
    message.disputed !== undefined && (obj.disputed = (message.disputed || Long.UZERO).toString());
    message.state !== undefined && (obj.state = collectionStateToJSON(message.state));
    message.payments !== undefined && (obj.payments = message.payments ? Payments.toJSON(message.payments) : undefined);
    message.signer !== undefined && (obj.signer = message.signer);
    message.invalidated !== undefined && (obj.invalidated = (message.invalidated || Long.UZERO).toString());
    message.escrowAccount !== undefined && (obj.escrowAccount = message.escrowAccount);
    message.intents !== undefined && (obj.intents = collectionIntentOptionsToJSON(message.intents));
    return obj;
  },
  fromPartial(object) {
    var _object$id, _object$entity, _object$admin, _object$protocol, _object$state, _object$signer, _object$escrowAccount, _object$intents;
    const message = createBaseCollection();
    message.id = (_object$id = object.id) !== null && _object$id !== void 0 ? _object$id : "";
    message.entity = (_object$entity = object.entity) !== null && _object$entity !== void 0 ? _object$entity : "";
    message.admin = (_object$admin = object.admin) !== null && _object$admin !== void 0 ? _object$admin : "";
    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.count = object.count !== undefined && object.count !== null ? Long.fromValue(object.count) : Long.UZERO;
    message.evaluated = object.evaluated !== undefined && object.evaluated !== null ? Long.fromValue(object.evaluated) : Long.UZERO;
    message.approved = object.approved !== undefined && object.approved !== null ? Long.fromValue(object.approved) : Long.UZERO;
    message.rejected = object.rejected !== undefined && object.rejected !== null ? Long.fromValue(object.rejected) : Long.UZERO;
    message.disputed = object.disputed !== undefined && object.disputed !== null ? Long.fromValue(object.disputed) : 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.signer = (_object$signer = object.signer) !== null && _object$signer !== void 0 ? _object$signer : "";
    message.invalidated = object.invalidated !== undefined && object.invalidated !== null ? Long.fromValue(object.invalidated) : Long.UZERO;
    message.escrowAccount = (_object$escrowAccount = object.escrowAccount) !== null && _object$escrowAccount !== void 0 ? _object$escrowAccount : "";
    message.intents = (_object$intents = object.intents) !== null && _object$intents !== void 0 ? _object$intents : 0;
    return message;
  }
};
function createBasePayments() {
  return {
    submission: undefined,
    evaluation: undefined,
    approval: undefined,
    rejection: undefined
  };
}
export const Payments = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.submission !== undefined) {
      Payment.encode(message.submission, writer.uint32(10).fork()).ldelim();
    }
    if (message.evaluation !== undefined) {
      Payment.encode(message.evaluation, writer.uint32(18).fork()).ldelim();
    }
    if (message.approval !== undefined) {
      Payment.encode(message.approval, writer.uint32(26).fork()).ldelim();
    }
    if (message.rejection !== undefined) {
      Payment.encode(message.rejection, 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 = createBasePayments();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.submission = Payment.decode(reader, reader.uint32());
          break;
        case 2:
          message.evaluation = Payment.decode(reader, reader.uint32());
          break;
        case 3:
          message.approval = Payment.decode(reader, reader.uint32());
          break;
        case 4:
          message.rejection = Payment.decode(reader, reader.uint32());
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      submission: isSet(object.submission) ? Payment.fromJSON(object.submission) : undefined,
      evaluation: isSet(object.evaluation) ? Payment.fromJSON(object.evaluation) : undefined,
      approval: isSet(object.approval) ? Payment.fromJSON(object.approval) : undefined,
      rejection: isSet(object.rejection) ? Payment.fromJSON(object.rejection) : undefined
    };
  },
  toJSON(message) {
    const obj = {};
    message.submission !== undefined && (obj.submission = message.submission ? Payment.toJSON(message.submission) : undefined);
    message.evaluation !== undefined && (obj.evaluation = message.evaluation ? Payment.toJSON(message.evaluation) : undefined);
    message.approval !== undefined && (obj.approval = message.approval ? Payment.toJSON(message.approval) : undefined);
    message.rejection !== undefined && (obj.rejection = message.rejection ? Payment.toJSON(message.rejection) : undefined);
    return obj;
  },
  fromPartial(object) {
    const message = createBasePayments();
    message.submission = object.submission !== undefined && object.submission !== null ? Payment.fromPartial(object.submission) : undefined;
    message.evaluation = object.evaluation !== undefined && object.evaluation !== null ? Payment.fromPartial(object.evaluation) : undefined;
    message.approval = object.approval !== undefined && object.approval !== null ? Payment.fromPartial(object.approval) : undefined;
    message.rejection = object.rejection !== undefined && object.rejection !== null ? Payment.fromPartial(object.rejection) : undefined;
    return message;
  }
};
function createBasePayment() {
  return {
    account: "",
    amount: [],
    contract_1155Payment: undefined,
    timeoutNs: undefined,
    cw20Payment: [],
    isOraclePayment: false,
    cw1155Payment: []
  };
}
export const Payment = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.account !== "") {
      writer.uint32(10).string(message.account);
    }
    for (const v of message.amount) {
      Coin.encode(v, writer.uint32(18).fork()).ldelim();
    }
    if (message.contract_1155Payment !== undefined) {
      Contract1155Payment.encode(message.contract_1155Payment, writer.uint32(26).fork()).ldelim();
    }
    if (message.timeoutNs !== undefined) {
      Duration.encode(message.timeoutNs, writer.uint32(34).fork()).ldelim();
    }
    for (const v of message.cw20Payment) {
      CW20Payment.encode(v, writer.uint32(42).fork()).ldelim();
    }
    if (message.isOraclePayment === true) {
      writer.uint32(48).bool(message.isOraclePayment);
    }
    for (const v of message.cw1155Payment) {
      CW1155Payment.encode(v, writer.uint32(58).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 = createBasePayment();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.account = reader.string();
          break;
        case 2:
          message.amount.push(Coin.decode(reader, reader.uint32()));
          break;
        case 3:
          message.contract_1155Payment = Contract1155Payment.decode(reader, reader.uint32());
          break;
        case 4:
          message.timeoutNs = Duration.decode(reader, reader.uint32());
          break;
        case 5:
          message.cw20Payment.push(CW20Payment.decode(reader, reader.uint32()));
          break;
        case 6:
          message.isOraclePayment = reader.bool();
          break;
        case 7:
          message.cw1155Payment.push(CW1155Payment.decode(reader, reader.uint32()));
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      account: isSet(object.account) ? String(object.account) : "",
      amount: Array.isArray(object === null || object === void 0 ? void 0 : object.amount) ? object.amount.map(e => Coin.fromJSON(e)) : [],
      contract_1155Payment: isSet(object.contract_1155Payment) ? Contract1155Payment.fromJSON(object.contract_1155Payment) : undefined,
      timeoutNs: isSet(object.timeoutNs) ? Duration.fromJSON(object.timeoutNs) : undefined,
      cw20Payment: Array.isArray(object === null || object === void 0 ? void 0 : object.cw20Payment) ? object.cw20Payment.map(e => CW20Payment.fromJSON(e)) : [],
      isOraclePayment: isSet(object.isOraclePayment) ? Boolean(object.isOraclePayment) : false,
      cw1155Payment: Array.isArray(object === null || object === void 0 ? void 0 : object.cw1155Payment) ? object.cw1155Payment.map(e => CW1155Payment.fromJSON(e)) : []
    };
  },
  toJSON(message) {
    const obj = {};
    message.account !== undefined && (obj.account = message.account);
    if (message.amount) {
      obj.amount = message.amount.map(e => e ? Coin.toJSON(e) : undefined);
    } else {
      obj.amount = [];
    }
    message.contract_1155Payment !== undefined && (obj.contract_1155Payment = message.contract_1155Payment ? Contract1155Payment.toJSON(message.contract_1155Payment) : undefined);
    message.timeoutNs !== undefined && (obj.timeoutNs = message.timeoutNs ? Duration.toJSON(message.timeoutNs) : undefined);
    if (message.cw20Payment) {
      obj.cw20Payment = message.cw20Payment.map(e => e ? CW20Payment.toJSON(e) : undefined);
    } else {
      obj.cw20Payment = [];
    }
    message.isOraclePayment !== undefined && (obj.isOraclePayment = message.isOraclePayment);
    if (message.cw1155Payment) {
      obj.cw1155Payment = message.cw1155Payment.map(e => e ? CW1155Payment.toJSON(e) : undefined);
    } else {
      obj.cw1155Payment = [];
    }
    return obj;
  },
  fromPartial(object) {
    var _object$account, _object$amount, _object$cw20Payment, _object$isOraclePayme, _object$cw1155Payment;
    const message = createBasePayment();
    message.account = (_object$account = object.account) !== null && _object$account !== void 0 ? _object$account : "";
    message.amount = ((_object$amount = object.amount) === null || _object$amount === void 0 ? void 0 : _object$amount.map(e => Coin.fromPartial(e))) || [];
    message.contract_1155Payment = object.contract_1155Payment !== undefined && object.contract_1155Payment !== null ? Contract1155Payment.fromPartial(object.contract_1155Payment) : undefined;
    message.timeoutNs = object.timeoutNs !== undefined && object.timeoutNs !== null ? Duration.fromPartial(object.timeoutNs) : undefined;
    message.cw20Payment = ((_object$cw20Payment = object.cw20Payment) === null || _object$cw20Payment === void 0 ? void 0 : _object$cw20Payment.map(e => CW20Payment.fromPartial(e))) || [];
    message.isOraclePayment = (_object$isOraclePayme = object.isOraclePayment) !== null && _object$isOraclePayme !== void 0 ? _object$isOraclePayme : false;
    message.cw1155Payment = ((_object$cw1155Payment = object.cw1155Payment) === null || _object$cw1155Payment === void 0 ? void 0 : _object$cw1155Payment.map(e => CW1155Payment.fromPartial(e))) || [];
    return message;
  }
};
function createBaseContract1155Payment() {
  return {
    address: "",
    tokenId: "",
    amount: 0
  };
}
export const Contract1155Payment = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.address !== "") {
      writer.uint32(10).string(message.address);
    }
    if (message.tokenId !== "") {
      writer.uint32(18).string(message.tokenId);
    }
    if (message.amount !== 0) {
      writer.uint32(24).uint32(message.amount);
    }
    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 = createBaseContract1155Payment();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.address = reader.string();
          break;
        case 2:
          message.tokenId = reader.string();
          break;
        case 3:
          message.amount = reader.uint32();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      address: isSet(object.address) ? String(object.address) : "",
      tokenId: isSet(object.tokenId) ? String(object.tokenId) : "",
      amount: isSet(object.amount) ? Number(object.amount) : 0
    };
  },
  toJSON(message) {
    const obj = {};
    message.address !== undefined && (obj.address = message.address);
    message.tokenId !== undefined && (obj.tokenId = message.tokenId);
    message.amount !== undefined && (obj.amount = Math.round(message.amount));
    return obj;
  },
  fromPartial(object) {
    var _object$address, _object$tokenId, _object$amount2;
    const message = createBaseContract1155Payment();
    message.address = (_object$address = object.address) !== null && _object$address !== void 0 ? _object$address : "";
    message.tokenId = (_object$tokenId = object.tokenId) !== null && _object$tokenId !== void 0 ? _object$tokenId : "";
    message.amount = (_object$amount2 = object.amount) !== null && _object$amount2 !== void 0 ? _object$amount2 : 0;
    return message;
  }
};
function createBaseCW1155Payment() {
  return {
    address: "",
    tokenId: [],
    amount: Long.UZERO
  };
}
export const CW1155Payment = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.address !== "") {
      writer.uint32(10).string(message.address);
    }
    for (const v of message.tokenId) {
      writer.uint32(18).string(v);
    }
    if (!message.amount.isZero()) {
      writer.uint32(24).uint64(message.amount);
    }
    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 = createBaseCW1155Payment();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.address = reader.string();
          break;
        case 2:
          message.tokenId.push(reader.string());
          break;
        case 3:
          message.amount = reader.uint64();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      address: isSet(object.address) ? String(object.address) : "",
      tokenId: Array.isArray(object === null || object === void 0 ? void 0 : object.tokenId) ? object.tokenId.map(e => String(e)) : [],
      amount: isSet(object.amount) ? Long.fromValue(object.amount) : Long.UZERO
    };
  },
  toJSON(message) {
    const obj = {};
    message.address !== undefined && (obj.address = message.address);
    if (message.tokenId) {
      obj.tokenId = message.tokenId.map(e => e);
    } else {
      obj.tokenId = [];
    }
    message.amount !== undefined && (obj.amount = (message.amount || Long.UZERO).toString());
    return obj;
  },
  fromPartial(object) {
    var _object$address2, _object$tokenId2;
    const message = createBaseCW1155Payment();
    message.address = (_object$address2 = object.address) !== null && _object$address2 !== void 0 ? _object$address2 : "";
    message.tokenId = ((_object$tokenId2 = object.tokenId) === null || _object$tokenId2 === void 0 ? void 0 : _object$tokenId2.map(e => e)) || [];
    message.amount = object.amount !== undefined && object.amount !== null ? Long.fromValue(object.amount) : Long.UZERO;
    return message;
  }
};
function createBaseCW1155IntentPayment() {
  return {
    address: "",
    tokens: []
  };
}
export const CW1155IntentPayment = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.address !== "") {
      writer.uint32(10).string(message.address);
    }
    for (const v of message.tokens) {
      CW1155IntentPaymentToken.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 = createBaseCW1155IntentPayment();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.address = reader.string();
          break;
        case 2:
          message.tokens.push(CW1155IntentPaymentToken.decode(reader, reader.uint32()));
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      address: isSet(object.address) ? String(object.address) : "",
      tokens: Array.isArray(object === null || object === void 0 ? void 0 : object.tokens) ? object.tokens.map(e => CW1155IntentPaymentToken.fromJSON(e)) : []
    };
  },
  toJSON(message) {
    const obj = {};
    message.address !== undefined && (obj.address = message.address);
    if (message.tokens) {
      obj.tokens = message.tokens.map(e => e ? CW1155IntentPaymentToken.toJSON(e) : undefined);
    } else {
      obj.tokens = [];
    }
    return obj;
  },
  fromPartial(object) {
    var _object$address3, _object$tokens;
    const message = createBaseCW1155IntentPayment();
    message.address = (_object$address3 = object.address) !== null && _object$address3 !== void 0 ? _object$address3 : "";
    message.tokens = ((_object$tokens = object.tokens) === null || _object$tokens === void 0 ? void 0 : _object$tokens.map(e => CW1155IntentPaymentToken.fromPartial(e))) || [];
    return message;
  }
};
function createBaseCW1155IntentPaymentToken() {
  return {
    tokenId: "",
    amount: Long.UZERO
  };
}
export const CW1155IntentPaymentToken = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.tokenId !== "") {
      writer.uint32(10).string(message.tokenId);
    }
    if (!message.amount.isZero()) {
      writer.uint32(16).uint64(message.amount);
    }
    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 = createBaseCW1155IntentPaymentToken();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.tokenId = reader.string();
          break;
        case 2:
          message.amount = reader.uint64();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      tokenId: isSet(object.tokenId) ? String(object.tokenId) : "",
      amount: isSet(object.amount) ? Long.fromValue(object.amount) : Long.UZERO
    };
  },
  toJSON(message) {
    const obj = {};
    message.tokenId !== undefined && (obj.tokenId = message.tokenId);
    message.amount !== undefined && (obj.amount = (message.amount || Long.UZERO).toString());
    return obj;
  },
  fromPartial(object) {
    var _object$tokenId3;
    const message = createBaseCW1155IntentPaymentToken();
    message.tokenId = (_object$tokenId3 = object.tokenId) !== null && _object$tokenId3 !== void 0 ? _object$tokenId3 : "";
    message.amount = object.amount !== undefined && object.amount !== null ? Long.fromValue(object.amount) : Long.UZERO;
    return message;
  }
};
function createBaseCW20Payment() {
  return {
    address: "",
    amount: Long.UZERO
  };
}
export const CW20Payment = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.address !== "") {
      writer.uint32(10).string(message.address);
    }
    if (!message.amount.isZero()) {
      writer.uint32(24).uint64(message.amount);
    }
    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 = createBaseCW20Payment();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.address = reader.string();
          break;
        case 3:
          message.amount = reader.uint64();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      address: isSet(object.address) ? String(object.address) : "",
      amount: isSet(object.amount) ? Long.fromValue(object.amount) : Long.UZERO
    };
  },
  toJSON(message) {
    const obj = {};
    message.address !== undefined && (obj.address = message.address);
    message.amount !== undefined && (obj.amount = (message.amount || Long.UZERO).toString());
    return obj;
  },
  fromPartial(object) {
    var _object$address4;
    const message = createBaseCW20Payment();
    message.address = (_object$address4 = object.address) !== null && _object$address4 !== void 0 ? _object$address4 : "";
    message.amount = object.amount !== undefined && object.amount !== null ? Long.fromValue(object.amount) : Long.UZERO;
    return message;
  }
};
function createBaseCW20Output() {
  return {
    address: "",
    contractAddress: "",
    amount: Long.UZERO
  };
}
export const CW20Output = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.address !== "") {
      writer.uint32(10).string(message.address);
    }
    if (message.contractAddress !== "") {
      writer.uint32(18).string(message.contractAddress);
    }
    if (!message.amount.isZero()) {
      writer.uint32(24).uint64(message.amount);
    }
    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 = createBaseCW20Output();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.address = reader.string();
          break;
        case 2:
          message.contractAddress = reader.string();
          break;
        case 3:
          message.amount = reader.uint64();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      address: isSet(object.address) ? String(object.address) : "",
      contractAddress: isSet(object.contractAddress) ? String(object.contractAddress) : "",
      amount: isSet(object.amount) ? Long.fromValue(object.amount) : Long.UZERO
    };
  },
  toJSON(message) {
    const obj = {};
    message.address !== undefined && (obj.address = message.address);
    message.contractAddress !== undefined && (obj.contractAddress = message.contractAddress);
    message.amount !== undefined && (obj.amount = (message.amount || Long.UZERO).toString());
    return obj;
  },
  fromPartial(object) {
    var _object$address5, _object$contractAddre;
    const message = createBaseCW20Output();
    message.address = (_object$address5 = object.address) !== null && _object$address5 !== void 0 ? _object$address5 : "";
    message.contractAddress = (_object$contractAddre = object.contractAddress) !== null && _object$contractAddre !== void 0 ? _object$contractAddre : "";
    message.amount = object.amount !== undefined && object.amount !== null ? Long.fromValue(object.amount) : Long.UZERO;
    return message;
  }
};
function createBaseClaim() {
  return {
    collectionId: "",
    agentDid: "",
    agentAddress: "",
    submissionDate: undefined,
    claimId: "",
    evaluation: undefined,
    paymentsStatus: undefined,
    useIntent: false,
    amount: [],
    cw20Payment: [],
    cw1155Payment: [],
    cw1155IntentPayment: []
  };
}
export const Claim = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.collectionId !== "") {
      writer.uint32(10).string(message.collectionId);
    }
    if (message.agentDid !== "") {
      writer.uint32(18).string(message.agentDid);
    }
    if (message.agentAddress !== "") {
      writer.uint32(26).string(message.agentAddress);
    }
    if (message.submissionDate !== undefined) {
      Timestamp.encode(message.submissionDate, writer.uint32(34).fork()).ldelim();
    }
    if (message.claimId !== "") {
      writer.uint32(42).string(message.claimId);
    }
    if (message.evaluation !== undefined) {
      Evaluation.encode(message.evaluation, writer.uint32(50).fork()).ldelim();
    }
    if (message.paymentsStatus !== undefined) {
      ClaimPayments.encode(message.paymentsStatus, writer.uint32(58).fork()).ldelim();
    }
    if (message.useIntent === true) {
      writer.uint32(64).bool(message.useIntent);
    }
    for (const v of message.amount) {
      Coin.encode(v, writer.uint32(74).fork()).ldelim();
    }
    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();
    }
    for (const v of message.cw1155IntentPayment) {
      CW1155IntentPayment.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 = createBaseClaim();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.collectionId = reader.string();
          break;
        case 2:
          message.agentDid = reader.string();
          break;
        case 3:
          message.agentAddress = reader.string();
          break;
        case 4:
          message.submissionDate = Timestamp.decode(reader, reader.uint32());
          break;
        case 5:
          message.claimId = reader.string();
          break;
        case 6:
          message.evaluation = Evaluation.decode(reader, reader.uint32());
          break;
        case 7:
          message.paymentsStatus = ClaimPayments.decode(reader, reader.uint32());
          break;
        case 8:
          message.useIntent = reader.bool();
          break;
        case 9:
          message.amount.push(Coin.decode(reader, reader.uint32()));
          break;
        case 10:
          message.cw20Payment.push(CW20Payment.decode(reader, reader.uint32()));
          break;
        case 11:
          message.cw1155Payment.push(CW1155Payment.decode(reader, reader.uint32()));
          break;
        case 12:
          message.cw1155IntentPayment.push(CW1155IntentPayment.decode(reader, reader.uint32()));
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      collectionId: isSet(object.collectionId) ? String(object.collectionId) : "",
      agentDid: isSet(object.agentDid) ? String(object.agentDid) : "",
      agentAddress: isSet(object.agentAddress) ? String(object.agentAddress) : "",
      submissionDate: isSet(object.submissionDate) ? fromJsonTimestamp(object.submissionDate) : undefined,
      claimId: isSet(object.claimId) ? String(object.claimId) : "",
      evaluation: isSet(object.evaluation) ? Evaluation.fromJSON(object.evaluation) : undefined,
      paymentsStatus: isSet(object.paymentsStatus) ? ClaimPayments.fromJSON(object.paymentsStatus) : undefined,
      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)) : [],
      cw1155IntentPayment: Array.isArray(object === null || object === void 0 ? void 0 : object.cw1155IntentPayment) ? object.cw1155IntentPayment.map(e => CW1155IntentPayment.fromJSON(e)) : []
    };
  },
  toJSON(message) {
    const obj = {};
    message.collectionId !== undefined && (obj.collectionId = message.collectionId);
    message.agentDid !== undefined && (obj.agentDid = message.agentDid);
    message.agentAddress !== undefined && (obj.agentAddress = message.agentAddress);
    message.submissionDate !== undefined && (obj.submissionDate = fromTimestamp(message.submissionDate).toISOString());
    message.claimId !== undefined && (obj.claimId = message.claimId);
    message.evaluation !== undefined && (obj.evaluation = message.evaluation ? Evaluation.toJSON(message.evaluation) : undefined);
    message.paymentsStatus !== undefined && (obj.paymentsStatus = message.paymentsStatus ? ClaimPayments.toJSON(message.paymentsStatus) : undefined);
    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 = [];
    }
    if (message.cw1155IntentPayment) {
      obj.cw1155IntentPayment = message.cw1155IntentPayment.map(e => e ? CW1155IntentPayment.toJSON(e) : undefined);
    } else {
      obj.cw1155IntentPayment = [];
    }
    return obj;
  },
  fromPartial(object) {
    var _object$collectionId, _object$agentDid, _object$agentAddress, _object$claimId, _object$useIntent, _object$amount3, _object$cw20Payment2, _object$cw1155Payment2, _object$cw1155IntentP;
    const message = createBaseClaim();
    message.collectionId = (_object$collectionId = object.collectionId) !== null && _object$collectionId !== void 0 ? _object$collectionId : "";
    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.submissionDate = object.submissionDate !== undefined && object.submissionDate !== null ? Timestamp.fromPartial(object.submissionDate) : undefined;
    message.claimId = (_object$claimId = object.claimId) !== null && _object$claimId !== void 0 ? _object$claimId : "";
    message.evaluation = object.evaluation !== undefined && object.evaluation !== null ? Evaluation.fromPartial(object.evaluation) : undefined;
    message.paymentsStatus = object.paymentsStatus !== undefined && object.paymentsStatus !== null ? ClaimPayments.fromPartial(object.paymentsStatus) : undefined;
    message.useIntent = (_object$useIntent = object.useIntent) !== null && _object$useIntent !== void 0 ? _object$useIntent : false;
    message.amount = ((_object$amount3 = object.amount) === null || _object$amount3 === void 0 ? void 0 : _object$amount3.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))) || [];
    message.cw1155IntentPayment = ((_object$cw1155IntentP = object.cw1155IntentPayment) === null || _object$cw1155IntentP === void 0 ? void 0 : _object$cw1155IntentP.map(e => CW1155IntentPayment.fromPartial(e))) || [];
    return message;
  }
};
function createBaseClaimPayments() {
  return {
    submission: 0,
    evaluation: 0,
    approval: 0,
    rejection: 0
  };
}
export const ClaimPayments = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.submission !== 0) {
      writer.uint32(8).int32(message.submission);
    }
    if (message.evaluation !== 0) {
      writer.uint32(16).int32(message.evaluation);
    }
    if (message.approval !== 0) {
      writer.uint32(24).int32(message.approval);
    }
    if (message.rejection !== 0) {
      writer.uint32(32).int32(message.rejection);
    }
    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 = createBaseClaimPayments();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.submission = reader.int32();
          break;
        case 2:
          message.evaluation = reader.int32();
          break;
        case 3:
          message.approval = reader.int32();
          break;
        case 4:
          message.rejection = reader.int32();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      submission: isSet(object.submission) ? paymentStatusFromJSON(object.submission) : 0,
      evaluation: isSet(object.evaluation) ? paymentStatusFromJSON(object.evaluation) : 0,
      approval: isSet(object.approval) ? paymentStatusFromJSON(object.approval) : 0,
      rejection: isSet(object.rejection) ? paymentStatusFromJSON(object.rejection) : 0
    };
  },
  toJSON(message) {
    const obj = {};
    message.submission !== undefined && (obj.submission = paymentStatusToJSON(message.submission));
    message.evaluation !== undefined && (obj.evaluation = paymentStatusToJSON(message.evaluation));
    message.approval !== undefined && (obj.approval = paymentStatusToJSON(message.approval));
    message.rejection !== undefined && (obj.rejection = paymentStatusToJSON(message.rejection));
    return obj;
  },
  fromPartial(object) {
    var _object$submission, _object$evaluation, _object$approval, _object$rejection;
    const message = createBaseClaimPayments();
    message.submission = (_object$submission = object.submission) !== null && _object$submission !== void 0 ? _object$submission : 0;
    message.evaluation = (_object$evaluation = object.evaluation) !== null && _object$evaluation !== void 0 ? _object$evaluation : 0;
    message.approval = (_object$approval = object.approval) !== null && _object$approval !== void 0 ? _object$approval : 0;
    message.rejection = (_object$rejection = object.rejection) !== null && _object$rejection !== void 0 ? _object$rejection : 0;
    return message;
  }
};
function createBaseEvaluation() {
  return {
    claimId: "",
    collectionId: "",
    oracle: "",
    agentDid: "",
    agentAddress: "",
    status: 0,
    reason: 0,
    verificationProof: "",
    evaluationDate: undefined,
    amount: [],
    cw20Payment: [],
    cw1155Payment: [],
    cw1155IntentPayment: []
  };
}
export const Evaluation = {
  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.status !== 0) {
      writer.uint32(48).int32(message.status);
    }
    if (message.reason !== 0) {
      writer.uint32(56).uint32(message.reason);
    }
    if (message.verificationProof !== "") {
      writer.uint32(66).string(message.verificationProof);
    }
    if (message.evaluationDate !== undefined) {
      Timestamp.encode(message.evaluationDate, writer.uint32(74).fork()).ldelim();
    }
    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();
    }
    for (const v of message.cw1155IntentPayment) {
      CW1155IntentPayment.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 = createBaseEvaluation();
    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.status = reader.int32();
          break;
        case 7:
          message.reason = reader.uint32();
          break;
        case 8:
          message.verificationProof = reader.string();
          break;
        case 9:
          message.evaluationDate = Timestamp.decode(reader, reader.uint32());
          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;
        case 13:
          message.cw1155IntentPayment.push(CW1155IntentPayment.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) : "",
      status: isSet(object.status) ? evaluationStatusFromJSON(object.status) : 0,
      reason: isSet(object.reason) ? Number(object.reason) : 0,
      verificationProof: isSet(object.verificationProof) ? String(object.verificationProof) : "",
      evaluationDate: isSet(object.evaluationDate) ? fromJsonTimestamp(object.evaluationDate) : undefined,
      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)) : [],
      cw1155IntentPayment: Array.isArray(object === null || object === void 0 ? void 0 : object.cw1155IntentPayment) ? object.cw1155IntentPayment.map(e => CW1155IntentPayment.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.status !== undefined && (obj.status = evaluationStatusToJSON(message.status));
    message.reason !== undefined && (obj.reason = Math.round(message.reason));
    message.verificationProof !== undefined && (obj.verificationProof = message.verificationProof);
    message.evaluationDate !== undefined && (obj.evaluationDate = fromTimestamp(message.evaluationDate).toISOString());
    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 = [];
    }
    if (message.cw1155IntentPayment) {
      obj.cw1155IntentPayment = message.cw1155IntentPayment.map(e => e ? CW1155IntentPayment.toJSON(e) : undefined);
    } else {
      obj.cw1155IntentPayment = [];
    }
    return obj;
  },
  fromPartial(object) {
    var _object$claimId2, _object$collectionId2, _object$oracle, _object$agentDid2, _object$agentAddress2, _object$status, _object$reason, _object$verificationP, _object$amount4, _object$cw20Payment3, _object$cw1155Payment3, _object$cw1155IntentP2;
    const message = createBaseEvaluation();
    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.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.evaluationDate = object.evaluationDate !== undefined && object.evaluationDate !== null ? Timestamp.fromPartial(object.evaluationDate) : undefined;
    message.amount = ((_object$amount4 = object.amount) === null || _object$amount4 === void 0 ? void 0 : _object$amount4.map(e => Coin.fromPartial(e))) || [];
    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))) || [];
    message.cw1155IntentPayment = ((_object$cw1155IntentP2 = object.cw1155IntentPayment) === null || _object$cw1155IntentP2 === void 0 ? void 0 : _object$cw1155IntentP2.map(e => CW1155IntentPayment.fromPartial(e))) || [];
    return message;
  }
};
function createBaseDispute() {
  return {
    subjectId: "",
    type: 0,
    data: undefined
  };
}
export const Dispute = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.subjectId !== "") {
      writer.uint32(10).string(message.subjectId);
    }
    if (message.type !== 0) {
      writer.uint32(16).int32(message.type);
    }
    if (message.data !== undefined) {
      DisputeData.encode(message.data, writer.uint32(26).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 = createBaseDispute();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.subjectId = reader.string();
          break;
        case 2:
          message.type = reader.int32();
          break;
        case 3:
          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) : "",
      type: isSet(object.type) ? Number(object.type) : 0,
      data: isSet(object.data) ? DisputeData.fromJSON(object.data) : undefined
    };
  },
  toJSON(message) {
    const obj = {};
    message.subjectId !== undefined && (obj.subjectId = message.subjectId);
    message.type !== undefined && (obj.type = Math.round(message.type));
    message.data !== undefined && (obj.data = message.data ? DisputeData.toJSON(message.data) : undefined);
    return obj;
  },
  fromPartial(object) {
    var _object$subjectId, _object$type;
    const message = createBaseDispute();
    message.subjectId = (_object$subjectId = object.subjectId) !== null && _object$subjectId !== void 0 ? _object$subjectId : "";
    message.type = (_object$type = object.type) !== null && _object$type !== void 0 ? _object$type : 0;
    message.data = object.data !== undefined && object.data !== null ? DisputeData.fromPartial(object.data) : undefined;
    return message;
  }
};
function createBaseDisputeData() {
  return {
    uri: "",
    type: "",
    proof: "",
    encrypted: false
  };
}
export const DisputeData = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.uri !== "") {
      writer.uint32(10).string(message.uri);
    }
    if (message.type !== "") {
      writer.uint32(18).string(message.type);
    }
    if (message.proof !== "") {
      writer.uint32(26).string(message.proof);
    }
    if (message.encrypted === true) {
      writer.uint32(32).bool(message.encrypted);
    }
    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 = createBaseDisputeData();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.uri = reader.string();
          break;
        case 2:
          message.type = reader.string();
          break;
        case 3:
          message.proof = reader.string();
          break;
        case 4:
          message.encrypted = reader.bool();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      uri: isSet(object.uri) ? String(object.uri) : "",
      type: isSet(object.type) ? String(object.type) : "",
      proof: isSet(object.proof) ? String(object.proof) : "",
      encrypted: isSet(object.encrypted) ? Boolean(object.encrypted) : false
    };
  },
  toJSON(message) {
    const obj = {};
    message.uri !== undefined && (obj.uri = message.uri);
    message.type !== undefined && (obj.type = message.type);
    message.proof !== undefined && (obj.proof = message.proof);
    message.encrypted !== undefined && (obj.encrypted = message.encrypted);
    return obj;
  },
  fromPartial(object) {
    var _object$uri, _object$type2, _object$proof, _object$encrypted;
    const message = createBaseDisputeData();
    message.uri = (_object$uri = object.uri) !== null && _object$uri !== void 0 ? _object$uri : "";
    message.type = (_object$type2 = object.type) !== null && _object$type2 !== void 0 ? _object$type2 : "";
    message.proof = (_object$proof = object.proof) !== null && _object$proof !== void 0 ? _object$proof : "";
    message.encrypted = (_object$encrypted = object.encrypted) !== null && _object$encrypted !== void 0 ? _object$encrypted : false;
    return message;
  }
};
function createBaseIntent() {
  return {
    id: "",
    agentDid: "",
    agentAddress: "",
    collectionId: "",
    claimId: "",
    createdAt: undefined,
    expireAt: undefined,
    status: 0,
    amount: [],
    cw20Payment: [],
    fromAddress: "",
    escrowAddress: "",
    cw1155Payment: [],
    cw1155IntentPayment: []
  };
}
export const Intent = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.id !== "") {
      writer.uint32(10).string(message.id);
    }
    if (message.agentDid !== "") {
      writer.uint32(18).string(message.agentDid);
    }
    if (message.agentAddress !== "") {
      writer.uint32(26).string(message.agentAddress);
    }
    if (message.collectionId !== "") {
      writer.uint32(34).string(message.collectionId);
    }
    if (message.claimId !== "") {
      writer.uint32(42).string(message.claimId);
    }
    if (message.createdAt !== undefined) {
      Timestamp.encode(message.createdAt, writer.uint32(50).fork()).ldelim();
    }
    if (message.expireAt !== undefined) {
      Timestamp.encode(message.expireAt, writer.uint32(58).fork()).ldelim();
    }
    if (message.status !== 0) {
      writer.uint32(64).int32(message.status);
    }
    for (const v of message.amount) {
      Coin.encode(v, writer.uint32(74).fork()).ldelim();
    }
    for (const v of message.cw20Payment) {
      CW20Payment.encode(v, writer.uint32(82).fork()).ldelim();
    }
    if (message.fromAddress !== "") {
      writer.uint32(90).string(message.fromAddress);
    }
    if (message.escrowAddress !== "") {
      writer.uint32(98).string(message.escrowAddress);
    }
    for (const v of message.cw1155Payment) {
      CW1155Payment.encode(v, writer.uint32(106).fork()).ldelim();
    }
    for (const v of message.cw1155IntentPayment) {
      CW1155IntentPayment.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 = createBaseIntent();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.id = reader.string();
          break;
        case 2:
          message.agentDid = reader.string();
          break;
        case 3:
          message.agentAddress = reader.string();
          break;
        case 4:
          message.collectionId = reader.string();
          break;
        case 5:
          message.claimId = reader.string();
          break;
        case 6:
          message.createdAt = Timestamp.decode(reader, reader.uint32());
          break;
        case 7:
          message.expireAt = Timestamp.decode(reader, reader.uint32());
          break;
        case 8:
          message.status = reader.int32();
          break;
        case 9:
          message.amount.push(Coin.decode(reader, reader.uint32()));
          break;
        case 10:
          message.cw20Payment.push(CW20Payment.decode(reader, reader.uint32()));
          break;
        case 11:
          message.fromAddress = reader.string();
          break;
        case 12:
          message.escrowAddress = reader.string();
          break;
        case 13:
          message.cw1155Payment.push(CW1155Payment.decode(reader, reader.uint32()));
          break;
        case 14:
          message.cw1155IntentPayment.push(CW1155IntentPayment.decode(reader, reader.uint32()));
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      id: isSet(object.id) ? String(object.id) : "",
      agentDid: isSet(object.agentDid) ? String(object.agentDid) : "",
      agentAddress: isSet(object.agentAddress) ? String(object.agentAddress) : "",
      collectionId: isSet(object.collectionId) ? String(object.collectionId) : "",
      claimId: isSet(object.claimId) ? String(object.claimId) : "",
      createdAt: isSet(object.createdAt) ? fromJsonTimestamp(object.createdAt) : undefined,
      expireAt: isSet(object.expireAt) ? fromJsonTimestamp(object.expireAt) : undefined,
      status: isSet(object.status) ? intentStatusFromJSON(object.status) : 0,
      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)) : [],
      fromAddress: isSet(object.fromAddress) ? String(object.fromAddress) : "",
      escrowAddress: isSet(object.escrowAddress) ? String(object.escrowAddress) : "",
      cw1155Payment: Array.isArray(object === null || object === void 0 ? void 0 : object.cw1155Payment) ? object.cw1155Payment.map(e => CW1155Payment.fromJSON(e)) : [],
      cw1155IntentPayment: Array.isArray(object === null || object === void 0 ? void 0 : object.cw1155IntentPayment) ? object.cw1155IntentPayment.map(e => CW1155IntentPayment.fromJSON(e)) : []
    };
  },
  toJSON(message) {
    const obj = {};
    message.id !== undefined && (obj.id = message.id);
    message.agentDid !== undefined && (obj.agentDid = message.agentDid);
    message.agentAddress !== undefined && (obj.agentAddress = message.agentAddress);
    message.collectionId !== undefined && (obj.collectionId = message.collectionId);
    message.claimId !== undefined && (obj.claimId = message.claimId);
    message.createdAt !== undefined && (obj.createdAt = fromTimestamp(message.createdAt).toISOString());
    message.expireAt !== undefined && (obj.expireAt = fromTimestamp(message.expireAt).toISOString());
    message.status !== undefined && (obj.status = intentStatusToJSON(message.status));
    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 = [];
    }
    message.fromAddress !== undefined && (obj.fromAddress = message.fromAddress);
    message.escrowAddress !== undefined && (obj.escrowAddress = message.escrowAddress);
    if (message.cw1155Payment) {
      obj.cw1155Payment = message.cw1155Payment.map(e => e ? CW1155Payment.toJSON(e) : undefined);
    } else {
      obj.cw1155Payment = [];
    }
    if (message.cw1155IntentPayment) {
      obj.cw1155IntentPayment = message.cw1155IntentPayment.map(e => e ? CW1155IntentPayment.toJSON(e) : undefined);
    } else {
      obj.cw1155IntentPayment = [];
    }
    return obj;
  },
  fromPartial(object) {
    var _object$id2, _object$agentDid3, _object$agentAddress3, _object$collectionId3, _object$claimId3, _object$status2, _object$amount5, _object$cw20Payment4, _object$fromAddress, _object$escrowAddress, _object$cw1155Payment4, _object$cw1155IntentP3;
    const message = createBaseIntent();
    message.id = (_object$id2 = object.id) !== null && _object$id2 !== void 0 ? _object$id2 : "";
    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.collectionId = (_object$collectionId3 = object.collectionId) !== null && _object$collectionId3 !== void 0 ? _object$collectionId3 : "";
    message.claimId = (_object$claimId3 = object.claimId) !== null && _object$claimId3 !== void 0 ? _object$claimId3 : "";
    message.createdAt = object.createdAt !== undefined && object.createdAt !== null ? Timestamp.fromPartial(object.createdAt) : undefined;
    message.expireAt = object.expireAt !== undefined && object.expireAt !== null ? Timestamp.fromPartial(object.expireAt) : undefined;
    message.status = (_object$status2 = object.status) !== null && _object$status2 !== void 0 ? _object$status2 : 0;
    message.amount = ((_object$amount5 = object.amount) === null || _object$amount5 === void 0 ? void 0 : _object$amount5.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.fromAddress = (_object$fromAddress = object.fromAddress) !== null && _object$fromAddress !== void 0 ? _object$fromAddress : "";
    message.escrowAddress = (_object$escrowAddress = object.escrowAddress) !== null && _object$escrowAddress !== void 0 ? _object$escrowAddress : "";
    message.cw1155Payment = ((_object$cw1155Payment4 = object.cw1155Payment) === null || _object$cw1155Payment4 === void 0 ? void 0 : _object$cw1155Payment4.map(e => CW1155Payment.fromPartial(e))) || [];
    message.cw1155IntentPayment = ((_object$cw1155IntentP3 = object.cw1155IntentPayment) === null || _object$cw1155IntentP3 === void 0 ? void 0 : _object$cw1155IntentP3.map(e => CW1155IntentPayment.fromPartial(e))) || [];
    return message;
  }
};