{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/lpsignal-app/json-schema/lpsignal-app-rule-schema.json",
  "title": "Rule",
  "x-generated": "2026-11-17",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/lpsignal-app-openapi.json#/components/schemas/Rule",
  "allOf": [
    {
      "$ref": "#/$defs/RuleInput"
    },
    {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "active": {
          "type": "boolean",
          "description": "within the plan's limit (rules past it are kept but do not run)"
        },
        "createdAt": {
          "type": "string"
        },
        "updatedAt": {
          "type": "string"
        }
      }
    }
  ],
  "$defs": {
    "RuleInput": {
      "type": "object",
      "required": [
        "name",
        "kind"
      ],
      "description": "kind net_apr needs minNet7d; depeg needs minDeviation; tvl_outflow needs minDrop. Thresholds are fractions.",
      "properties": {
        "name": {
          "type": "string",
          "maxLength": 60
        },
        "kind": {
          "type": "string",
          "enum": [
            "net_apr",
            "depeg",
            "tvl_outflow"
          ]
        },
        "enabled": {
          "type": "boolean"
        },
        "chains": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "ethereum",
              "bsc",
              "base",
              "arbitrum",
              "optimism",
              "polygon",
              "robinhood"
            ]
          }
        },
        "pools": {
          "type": "array",
          "items": {
            "type": "string",
            "description": "\"<chain>:<address>\""
          },
          "maxItems": 50
        },
        "pairClasses": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "stable",
              "correlated",
              "volatile"
            ]
          }
        },
        "minTvlUsd": {
          "type": "number",
          "minimum": 100000
        },
        "cooldownHours": {
          "type": "integer",
          "minimum": 24,
          "maximum": 720
        },
        "minNet7d": {
          "type": "number"
        },
        "minNet24h": {
          "type": "number"
        },
        "minInRange7d": {
          "type": "number"
        },
        "minDeviation": {
          "type": "number"
        },
        "minDrop": {
          "type": "number"
        },
        "windowHours": {
          "type": "integer",
          "minimum": 1,
          "maximum": 24
        }
      }
    }
  }
}