{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/peoplescourt-ai/json-schema/peoplescourt-ai-canonical-fee-schema.json",
  "title": "CanonicalFee",
  "x-generated": "2026-11-21",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/peoplescourt-ai-fees-api-openapi.yml#/components/schemas/CanonicalFee",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schemaVersion",
    "feeId",
    "caseId",
    "type",
    "status",
    "amount"
  ],
  "properties": {
    "schemaVersion": {
      "type": "string",
      "const": "fee-v1"
    },
    "feeId": {
      "type": "string"
    },
    "caseId": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "enum": [
        "filing",
        "appeal",
        "evaluation"
      ]
    },
    "status": {
      "type": "string",
      "enum": [
        "quoted",
        "payable",
        "paid",
        "waived",
        "cancelled"
      ]
    },
    "amount": {
      "$ref": "#/$defs/FiatMoney"
    },
    "method": {
      "type": "string",
      "enum": [
        "x402",
        "onchain_usdc",
        "fiat_card",
        "fiat_ach",
        "court_filing_credit",
        "manual"
      ]
    },
    "collectionDisposition": {
      "type": "string"
    },
    "incurredBy": {
      "type": "string",
      "description": "The act that incurred the fee, such as filing or appeal_docket."
    },
    "incurredAt": {
      "type": "string",
      "format": "date-time"
    },
    "expiresAt": {
      "type": "string",
      "format": "date-time",
      "description": "Unpaid past this instant, the fee lapses under its own deadline."
    },
    "paidAt": {
      "type": "string",
      "format": "date-time"
    },
    "waivedReason": {
      "type": "string"
    },
    "supplementsFeeId": {
      "type": "string"
    },
    "checkout": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "method",
        "httpMethod",
        "endpoint"
      ],
      "description": "Present while the fee is payable.",
      "properties": {
        "method": {
          "type": "string"
        },
        "httpMethod": {
          "type": "string",
          "const": "POST"
        },
        "endpoint": {
          "type": "string"
        }
      }
    },
    "paymentState": {
      "type": "string",
      "enum": [
        "processing",
        "succeeded",
        "failed",
        "returned",
        "reconciliation_required"
      ]
    },
    "refundState": {
      "type": "string",
      "enum": [
        "pending",
        "succeeded",
        "failed",
        "reconciliation_required"
      ]
    }
  },
  "$defs": {
    "FiatMoney": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "currency",
        "minorUnits"
      ],
      "properties": {
        "currency": {
          "type": "string",
          "const": "USD"
        },
        "minorUnits": {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]{0,77})$"
        }
      }
    }
  }
}