{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/peoplescourt-ai/json-schema/peoplescourt-ai-award-execution-resource-schema.json",
  "title": "AwardExecutionResource",
  "x-generated": "2026-11-20",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/peoplescourt-ai-openapi.json#/components/schemas/AwardExecutionResource",
  "type": "object",
  "required": [
    "id",
    "caseId",
    "awardId",
    "awardHash",
    "mode",
    "status",
    "paymentConfirmed",
    "executedBy",
    "receipt",
    "reports",
    "links"
  ],
  "properties": {
    "provider": {
      "type": "string"
    },
    "providerOperation": {
      "type": "object",
      "required": [
        "id",
        "status",
        "attempts"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "status": {
          "enum": [
            "prepared",
            "submitting",
            "unknown",
            "confirmed",
            "needs_action"
          ]
        },
        "attempts": {
          "type": "integer",
          "minimum": 0
        }
      }
    },
    "reconciliation": {
      "type": "object",
      "required": [
        "state",
        "checkedAt",
        "recovery"
      ],
      "properties": {
        "state": {
          "enum": [
            "pending",
            "unknown",
            "confirmed",
            "needs_action",
            "reversed"
          ]
        },
        "checkedAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "recovery": {
          "type": [
            "object",
            "null"
          ],
          "properties": {
            "reason": {
              "enum": [
                "vacated",
                "superseded",
                "provider_reversal"
              ]
            },
            "status": {
              "enum": [
                "pending",
                "reversed",
                "needs_action"
              ]
            },
            "detail": {
              "type": "string"
            },
            "requestedAt": {
              "type": "string",
              "format": "date-time"
            },
            "updatedAt": {
              "type": "string",
              "format": "date-time"
            }
          }
        }
      }
    },
    "providerReceipts": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "step",
          "id",
          "object",
          "amount",
          "currency",
          "livemode",
          "status"
        ],
        "properties": {
          "step": {
            "enum": [
              "debit",
              "transfer",
              "reverse_transfer",
              "refund_debit"
            ]
          },
          "id": {
            "type": "string"
          },
          "object": {
            "enum": [
              "charge",
              "payment",
              "transfer",
              "transfer_reversal",
              "refund"
            ]
          },
          "amount": {
            "type": "integer",
            "minimum": 1
          },
          "currency": {
            "const": "usd"
          },
          "livemode": {
            "type": "boolean"
          },
          "source": {
            "type": "string"
          },
          "destination": {
            "type": "string"
          },
          "status": {
            "type": "string"
          }
        }
      }
    },
    "id": {
      "type": "string"
    },
    "caseId": {
      "type": "string"
    },
    "awardId": {
      "type": "string"
    },
    "awardHash": {
      "type": "string"
    },
    "mode": {
      "type": "string",
      "enum": [
        "partner_executed",
        "court_escrow",
        "external_provider",
        "decision_only"
      ]
    },
    "status": {
      "type": "string",
      "enum": [
        "decision_delivered",
        "execution_pending",
        "overdue",
        "will_not_execute",
        "not_automatically_executed",
        "performance_reported",
        "performance_acknowledged",
        "performance_disputed",
        "not_requested",
        "pending",
        "unknown_outcome",
        "needs_action",
        "blocked",
        "executed",
        "simulated",
        "reversal_pending",
        "reversed",
        "reversal_needs_action"
      ]
    },
    "paymentConfirmed": {
      "type": "boolean"
    },
    "executedBy": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "partner",
        "peoples_court",
        "provider",
        null
      ]
    },
    "receipt": {
      "oneOf": [
        {
          "$ref": "#/$defs/ExecutionReceipt"
        },
        {
          "type": "null"
        }
      ]
    },
    "reports": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ExecutionPerformanceReport"
      }
    },
    "attestation": {
      "oneOf": [
        {
          "$ref": "#/$defs/ExecutionNonPerformanceAttestation"
        },
        {
          "type": "null"
        }
      ]
    },
    "submissionAttempts": {
      "type": [
        "integer",
        "null"
      ],
      "minimum": 0,
      "description": "Durable adapter invocations, excluding reconciliation reads. Historical counts are null when unavailable. An invocation may stop before provider submission."
    },
    "deliveredAt": {
      "type": "string",
      "format": "date-time"
    },
    "overdueAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "nextReconcileAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "reminders": {
      "type": "integer",
      "minimum": 0
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time"
    },
    "links": {
      "type": "object",
      "required": [
        "self",
        "case"
      ],
      "properties": {
        "self": {
          "type": "string"
        },
        "case": {
          "type": "string"
        }
      }
    }
  },
  "$defs": {
    "ExecutionNonPerformanceAttestation": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "reason",
        "at"
      ],
      "properties": {
        "reason": {
          "type": "string"
        },
        "at": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "ExecutionPerformanceReport": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "by",
        "description",
        "reportedAt",
        "responses"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "by": {
          "type": "string",
          "enum": [
            "claimant",
            "respondent",
            "partner"
          ]
        },
        "description": {
          "type": "string"
        },
        "reference": {
          "type": "string"
        },
        "reportedAt": {
          "type": "string",
          "format": "date-time"
        },
        "responses": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ExecutionPerformanceResponse"
          }
        }
      }
    },
    "ExecutionPerformanceResponse": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "by",
        "status",
        "at"
      ],
      "properties": {
        "by": {
          "type": "string",
          "enum": [
            "claimant",
            "respondent"
          ]
        },
        "status": {
          "type": "string",
          "enum": [
            "acknowledged",
            "disputed"
          ]
        },
        "reason": {
          "type": "string"
        },
        "at": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "ExecutionReceipt": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "adapter",
        "action",
        "txHashes",
        "at"
      ],
      "properties": {
        "adapter": {
          "type": "string"
        },
        "action": {
          "type": "string",
          "enum": [
            "capture",
            "void",
            "capture_partial",
            "refund",
            "refuse",
            "complete",
            "reject",
            "distribute",
            "partner_execute"
          ]
        },
        "txHashes": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "at": {
          "type": "string",
          "format": "date-time"
        },
        "detail": {
          "type": "string"
        },
        "provenance": {
          "$ref": "#/$defs/ExecutionReceiptProvenance"
        }
      }
    },
    "ExecutionReceiptProvenance": {
      "type": "string",
      "enum": [
        "live",
        "test",
        "synthetic"
      ],
      "description": "Provider environment recorded by the engine. Missing historical provenance never confirms payment."
    }
  }
}