{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/ai2fin-com/json-schema/ai2fin-com-custom-rule-input-schema.json",
  "title": "CustomRuleInput",
  "x-generated": "2026-11-01",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/ai2fin-com-openapi.json#/components/schemas/CustomRuleInput",
  "type": "object",
  "required": [
    "name",
    "entityType",
    "conditions",
    "actions"
  ],
  "properties": {
    "name": {
      "type": "string"
    },
    "description": {
      "type": "string"
    },
    "entityType": {
      "type": "string",
      "enum": [
        "transaction",
        "bill",
        "expense",
        "billPattern",
        "billOccurrence"
      ]
    },
    "conditions": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "field": {
            "type": "string"
          },
          "operator": {
            "type": "string",
            "enum": [
              "equals",
              "contains",
              "starts_with",
              "ends_with",
              "greater_than",
              "less_than",
              "regex"
            ]
          },
          "value": {
            "type": "string"
          },
          "caseSensitive": {
            "type": "boolean"
          }
        }
      }
    },
    "actions": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "set_category",
              "set_tax_deductible",
              "set_business_percentage",
              "set_merchant"
            ]
          },
          "value": {
            "type": "string"
          }
        }
      }
    },
    "priority": {
      "type": "integer",
      "default": 0
    },
    "autoExecute": {
      "type": "boolean",
      "default": false
    }
  }
}