{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/domani-run/json-schema/domani-run-deal-invoice-schema.json",
  "title": "DealInvoice",
  "description": "A role-aware receipt (buyer) or statement (seller) for a marketplace deal",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/domani-run-marketplace-api-openapi.yml#/components/schemas/DealInvoice",
  "type": "object",
  "properties": {
    "deal_id": {
      "type": "string"
    },
    "domain": {
      "type": "string"
    },
    "date": {
      "type": "string",
      "format": "date-time"
    },
    "status": {
      "type": "string"
    },
    "your_role": {
      "type": "string",
      "enum": [
        "buyer",
        "seller"
      ]
    },
    "currency": {
      "type": "string"
    },
    "line_items": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "description": {
            "type": "string"
          },
          "amount": {
            "type": "number",
            "description": "USD; negative for deductions like commission"
          }
        }
      }
    },
    "total": {
      "type": "number",
      "description": "Buyer: amount paid. Seller: net payout after commission."
    },
    "commission_rate": {
      "type": "number",
      "description": "Platform commission percent"
    },
    "commission_amount": {
      "type": "number",
      "description": "Platform commission in USD"
    },
    "payment_method": {
      "type": "string",
      "description": "Buyer only"
    },
    "payout_method": {
      "type": "string",
      "enum": [
        "bank",
        "balance"
      ],
      "description": "Seller only"
    },
    "payout_status": {
      "type": "string",
      "enum": [
        "paid",
        "credited",
        "pending"
      ],
      "description": "Seller only"
    }
  }
}