{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/marketsdk/json-schema/marketsdk-dispute-object-schema.json",
  "title": "DisputeObject",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/marketsdk-trust-api-openapi.yml#/components/schemas/DisputeObject",
  "type": "object",
  "properties": {
    "object": {
      "type": "string",
      "enum": [
        "dispute"
      ]
    },
    "id": {
      "type": "string"
    },
    "order": {
      "type": "string"
    },
    "kind": {
      "type": "string",
      "enum": [
        "claimed_order",
        "completed_order"
      ]
    },
    "opened_by": {
      "type": "string",
      "enum": [
        "buyer",
        "seller"
      ]
    },
    "opener": {
      "type": "string"
    },
    "reason": {
      "type": [
        "string",
        "null"
      ],
      "description": "Null once the opener's data is erased."
    },
    "stage": {
      "type": "string",
      "enum": [
        "evidence",
        "awaiting_decision",
        "decided"
      ]
    },
    "evidence_due_at": {
      "type": "string",
      "format": "date-time"
    },
    "decision_due_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "overdue": {
      "type": "boolean",
      "description": "True once the decision time limit has passed with no decision."
    },
    "evidence_count": {
      "type": "number",
      "description": "Pieces of evidence given so far."
    },
    "decision": {
      "anyOf": [
        {
          "$ref": "#/$defs/DisputeDecisionObject"
        },
        {
          "type": "null"
        }
      ]
    },
    "card_disputes": {
      "description": "Card disputes on the same order, linked here but separate.",
      "type": "array",
      "items": {
        "$ref": "#/$defs/CardDisputeObject"
      }
    },
    "metadata": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    }
  },
  "required": [
    "object",
    "id",
    "order",
    "kind",
    "opened_by",
    "opener",
    "reason",
    "stage",
    "evidence_due_at",
    "decision_due_at",
    "overdue",
    "evidence_count",
    "decision",
    "card_disputes",
    "metadata",
    "created_at",
    "updated_at"
  ],
  "$defs": {
    "CardDisputeObject": {
      "type": "object",
      "properties": {
        "object": {
          "type": "string",
          "enum": [
            "card_dispute"
          ]
        },
        "id": {
          "type": "string"
        },
        "order": {
          "type": "string"
        },
        "stripe_dispute": {
          "type": "string",
          "description": "The dispute's id on your Stripe account."
        },
        "amount": {
          "type": "number"
        },
        "currency": {
          "type": "string"
        },
        "reason": {
          "type": "string"
        },
        "status": {
          "type": "string",
          "description": "Stripe's status, such as needs_response, won, or lost."
        },
        "created_at": {
          "type": "string",
          "format": "date-time"
        }
      },
      "required": [
        "object",
        "id",
        "order",
        "stripe_dispute",
        "amount",
        "currency",
        "reason",
        "status",
        "created_at"
      ]
    },
    "DisputeDecisionObject": {
      "type": "object",
      "properties": {
        "against": {
          "type": "string",
          "enum": [
            "buyer",
            "seller"
          ]
        },
        "outcome": {
          "type": "string",
          "enum": [
            "claim_upheld",
            "claim_rejected",
            "decided"
          ],
          "description": "`decided` for a dispute on a completed order, which has no claim to uphold."
        },
        "refund_amount": {
          "type": [
            "number",
            "null"
          ],
          "description": "Refunded to the buyer by this decision. Null with payments off."
        },
        "note": {
          "type": "string"
        },
        "decided_by": {
          "type": [
            "string",
            "null"
          ]
        },
        "decided_at": {
          "type": "string",
          "format": "date-time"
        }
      },
      "required": [
        "against",
        "outcome",
        "refund_amount",
        "note",
        "decided_by",
        "decided_at"
      ]
    }
  }
}