{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/arkrel-com/json-schema/arkrel-com-category-rule-input-schema.json",
  "title": "CategoryRuleInput",
  "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/CategoryRuleInput",
  "type": "object",
  "required": [
    "pattern",
    "account_id"
  ],
  "properties": {
    "match_field": {
      "type": "string",
      "enum": [
        "description",
        "payee"
      ],
      "default": "description",
      "description": "Invalid values return HTTP 400."
    },
    "pattern_type": {
      "type": "string",
      "enum": [
        "contains",
        "starts_with",
        "exact",
        "regex"
      ],
      "default": "contains",
      "description": "Invalid values return HTTP 400."
    },
    "pattern": {
      "type": "string",
      "minLength": 1
    },
    "amount_direction": {
      "type": "string",
      "enum": [
        "any",
        "credit",
        "debit"
      ],
      "default": "any",
      "description": "Invalid values return HTTP 400."
    },
    "min_amount": {
      "type": [
        "number",
        "null"
      ]
    },
    "max_amount": {
      "type": [
        "number",
        "null"
      ]
    },
    "account_id": {
      "type": "string",
      "minLength": 1
    },
    "is_transfer": {
      "type": "boolean"
    },
    "priority": {
      "type": "integer",
      "default": 20,
      "description": "Higher runs first. Defaults to 20 when omitted, above every built-in standard rule's own priority (10), so a rule you create always beats a built-in default for the same transaction without you having to think about the number."
    },
    "active": {
      "type": "boolean"
    },
    "client_id": {
      "type": [
        "string",
        "null"
      ]
    }
  }
}