{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/arkrel-com/json-schema/arkrel-com-category-rule-schema.json",
  "title": "CategoryRule",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/arkrel-com-category-rules-api-openapi.yml#/components/schemas/CategoryRule",
  "type": "object",
  "required": [
    "id",
    "match_field",
    "pattern_type",
    "pattern",
    "amount_direction",
    "account_id",
    "is_transfer",
    "priority",
    "active",
    "created_at",
    "updated_at"
  ],
  "properties": {
    "id": {
      "type": "string"
    },
    "client_id": {
      "type": [
        "string",
        "null"
      ]
    },
    "match_field": {
      "type": "string",
      "enum": [
        "description",
        "payee"
      ]
    },
    "pattern_type": {
      "type": "string",
      "enum": [
        "contains",
        "starts_with",
        "exact",
        "regex"
      ]
    },
    "pattern": {
      "type": "string"
    },
    "amount_direction": {
      "type": "string",
      "enum": [
        "any",
        "credit",
        "debit"
      ]
    },
    "min_amount": {
      "type": [
        "number",
        "null"
      ]
    },
    "max_amount": {
      "type": [
        "number",
        "null"
      ]
    },
    "account_id": {
      "type": "string"
    },
    "is_transfer": {
      "type": "boolean"
    },
    "priority": {
      "type": "integer"
    },
    "active": {
      "type": "boolean"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    },
    "match_count": {
      "type": "integer",
      "description": "How many transactions this rule has actually categorized so far. Only present on GET /category-rules (the list); a create/update response returns the rule alone."
    }
  }
}