{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://weverlabs.com/schemas/financeops-reconciliation-request.schema.json",
  "title": "FinanceOps Reconciliation Request",
  "type": "object",
  "required": [
    "object_type",
    "requested_tool",
    "workflow_type",
    "source_records",
    "callback"
  ],
  "properties": {
    "object_type": {
      "const": "financeops_reconciliation_request"
    },
    "requested_tool": {
      "const": "financeops"
    },
    "workflow_type": {
      "enum": [
        "reconciliation_review",
        "invoice_record_review",
        "payment_exception_review",
        "settlement_record_review",
        "credit_usage_review"
      ]
    },
    "run_contract_id": {
      "type": "string"
    },
    "quote_id": {
      "type": "string"
    },
    "credit_entitlement_id": {
      "type": "string"
    },
    "source_records": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "record_id": {
            "type": "string"
          },
          "record_type": {
            "type": "string"
          },
          "amount": {
            "type": "number"
          },
          "currency_or_asset": {
            "type": "string"
          },
          "reference": {
            "type": "string"
          }
        },
        "required": [
          "record_id",
          "record_type"
        ]
      }
    },
    "expected_amount": {
      "type": "number"
    },
    "received_amount": {
      "type": "number"
    },
    "currency_or_asset": {
      "type": "string"
    },
    "counterparty": {
      "type": "string"
    },
    "callback": {
      "type": "object",
      "properties": {
        "url": {
          "type": "string"
        },
        "events": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    }
  }
}