{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/arkrel-com/json-schema/arkrel-com-tax-year-transaction-schema.json",
  "title": "TaxYearTransaction",
  "x-generated": "2026-11-01",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/arkrel-com-openapi.yaml#/components/schemas/TaxYearTransaction",
  "type": "object",
  "required": [
    "document_id",
    "row_index",
    "source_document_type",
    "date",
    "description",
    "amount",
    "status",
    "needs_input",
    "reconciled"
  ],
  "properties": {
    "document_id": {
      "type": "string"
    },
    "row_index": {
      "type": "integer"
    },
    "source_document_type": {
      "type": "string",
      "enum": [
        "bank_statement",
        "receipt",
        "invoice"
      ]
    },
    "date": {
      "type": "string",
      "description": "Transaction date, or an empty string when our reading missed the date."
    },
    "description": {
      "type": "string"
    },
    "amount": {
      "type": [
        "number",
        "null"
      ],
      "description": "Signed amount, or null when our reading missed the amount. Review items are excluded from totals."
    },
    "review_reason": {
      "type": [
        "string",
        "null"
      ]
    },
    "review_note": {
      "type": "string",
      "description": "Informational note for a matched invoice paid in a different year from bank posting. The pair appears once in the payment year; this note does not exclude it from totals."
    },
    "currency": {
      "type": [
        "string",
        "null"
      ]
    },
    "account_id": {
      "type": [
        "string",
        "null"
      ]
    },
    "account_name": {
      "type": [
        "string",
        "null"
      ]
    },
    "account_type": {
      "type": [
        "string",
        "null"
      ],
      "allOf": [
        {
          "$ref": "#/$defs/AccountType"
        }
      ]
    },
    "tax_line": {
      "type": [
        "string",
        "null"
      ]
    },
    "is_transfer": {
      "type": "boolean"
    },
    "confidence": {
      "type": [
        "number",
        "null"
      ]
    },
    "status": {
      "$ref": "#/$defs/CategorizationStatus"
    },
    "needs_input": {
      "type": "boolean"
    },
    "needs_input_reason": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "large_purchase",
        "vehicle_unanswered",
        "llm_suggestion",
        "no_suggestion",
        "transfer_suggestion",
        null
      ],
      "description": "AI transfer flags always require review as transfer_suggestion, regardless of confidence. They do not set is_transfer until confirmed."
    },
    "reconciled": {
      "type": "boolean"
    },
    "source_page": {
      "type": [
        "integer",
        "null"
      ]
    }
  },
  "$defs": {
    "AccountType": {
      "type": "string",
      "enum": [
        "asset",
        "liability",
        "equity",
        "income",
        "expense",
        "personal"
      ],
      "description": "personal is this product's own addition, a personal-spending account, never a business classification, never deductible."
    },
    "CategorizationStatus": {
      "type": "string",
      "enum": [
        "needs_review",
        "categorized",
        "accepted"
      ]
    }
  }
}