{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://weverlabs.com/schemas/financeops-reference-workflow.schema.json",
  "title": "FinanceOps Reference Workflow",
  "type": "object",
  "required": [
    "workflow_id",
    "operating_tool",
    "workflow_type",
    "runtime_record_id",
    "records",
    "checks",
    "outputs"
  ],
  "properties": {
    "workflow_id": {
      "type": "string"
    },
    "operating_tool": {
      "const": "financeops"
    },
    "workflow_type": {
      "const": "reconciliation_review"
    },
    "runtime_record_id": {
      "type": "string"
    },
    "run_contract_id": {
      "type": "string"
    },
    "records": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "record_id": {
            "type": "string"
          },
          "record_type": {
            "type": "string"
          },
          "source_reference": {
            "type": "string"
          },
          "amount": {
            "type": [
              "number",
              "null"
            ]
          },
          "currency_or_asset": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string"
          }
        }
      }
    },
    "checks": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "check_id": {
            "type": "string"
          },
          "check_type": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "finding": {
            "type": "string"
          },
          "source_record_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      }
    },
    "exceptions": {
      "type": "array",
      "items": {
        "type": "object"
      }
    },
    "outputs": {
      "type": "object",
      "properties": {
        "result_package_url": {
          "type": "string"
        },
        "usage_receipt_url": {
          "type": "string"
        },
        "settlement_receipt_url": {
          "type": "string"
        },
        "callback_state": {
          "type": "string"
        },
        "task_ledger_url": {
          "type": "string"
        },
        "attestation_url": {
          "type": "string"
        }
      }
    }
  }
}