{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/robosystems-ai/json-schema/robosystems-ai-database-health-response-schema.json",
  "title": "DatabaseHealthResponse",
  "description": "Response model for database health check.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/robosystems-ai-graph-health-api-openapi.yml#/components/schemas/DatabaseHealthResponse",
  "properties": {
    "graph_id": {
      "type": "string",
      "title": "Graph Id",
      "description": "Graph database identifier"
    },
    "status": {
      "type": "string",
      "title": "Status",
      "description": "Overall health status"
    },
    "connection_status": {
      "type": "string",
      "title": "Connection Status",
      "description": "Database connection status"
    },
    "uptime_seconds": {
      "type": "number",
      "title": "Uptime Seconds",
      "description": "Database uptime in seconds"
    },
    "last_query_time": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Last Query Time",
      "description": "Timestamp of last query execution"
    },
    "query_count_24h": {
      "type": "integer",
      "title": "Query Count 24H",
      "description": "Number of queries executed in last 24 hours"
    },
    "avg_query_time_ms": {
      "type": "number",
      "title": "Avg Query Time Ms",
      "description": "Average query execution time in milliseconds"
    },
    "error_rate_24h": {
      "type": "number",
      "title": "Error Rate 24H",
      "description": "Error rate in last 24 hours (percentage)"
    },
    "memory_usage_mb": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Memory Usage Mb",
      "description": "Instance memory in use, MB. Only populated for dedicated single-tenant instances; null on shared repositories and packed tiers."
    },
    "memory_usage_percent": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Memory Usage Percent",
      "description": "Instance memory in use, percent. Expect high values during materialization — the engine deliberately boosts to near the whole instance while rebuilding. Read `resource_status` rather than this number alone. Dedicated instances only."
    },
    "cpu_usage_percent": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Cpu Usage Percent",
      "description": "Instance CPU in use, percent. Dedicated single-tenant instances only."
    },
    "resource_status": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Resource Status",
      "description": "Interpreted instance load: 'idle' (headroom), 'busy' (working normally — typical while materializing), 'constrained' (sustained pressure worth acting on). Null when resource metrics are not exposed."
    },
    "storage_usage_mb": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Storage Usage Mb",
      "description": "Storage usage in MB"
    },
    "alerts": {
      "items": {
        "type": "string"
      },
      "type": "array",
      "title": "Alerts",
      "description": "Active alerts or warnings"
    },
    "is_stale": {
      "type": "boolean",
      "title": "Is Stale",
      "description": "Whether the graph has staged changes not yet materialized",
      "default": false
    },
    "stale_reason": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Stale Reason",
      "description": "Reason the graph was marked stale (e.g. 'file_deleted: data.parquet')"
    },
    "stale_since": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Stale Since",
      "description": "ISO timestamp when the graph became stale"
    },
    "last_materialized_at": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Last Materialized At",
      "description": "ISO timestamp of the last successful materialization"
    },
    "hours_since_materialization": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Hours Since Materialization",
      "description": "Hours elapsed since last materialization"
    }
  },
  "type": "object",
  "required": [
    "graph_id",
    "status",
    "connection_status",
    "uptime_seconds",
    "query_count_24h",
    "avg_query_time_ms",
    "error_rate_24h"
  ]
}