{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "audit_task.schema.json",
  "title": "Audit Task",
  "type": "object",
  "properties": {
    "task_id": {
      "type": "string"
    },
    "unit_id": {
      "type": "string"
    },
    "pass_id": {
      "type": "string"
    },
    "lens": {
      "type": "string",
      "enum": [
        "correctness",
        "architecture",
        "maintainability",
        "security",
        "reliability",
        "performance",
        "data_integrity",
        "tests",
        "operability",
        "config_deployment",
        "observability"
      ]
    },
    "file_paths": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "minItems": 1
    },
    "file_line_counts": {
      "type": "object",
      "additionalProperties": {
        "type": "integer",
        "minimum": 0
      }
    },
    "line_ranges": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string"
          },
          "start": {
            "type": "integer",
            "minimum": 1
          },
          "end": {
            "type": "integer",
            "minimum": 1
          }
        },
        "required": [
          "path",
          "start",
          "end"
        ],
        "additionalProperties": false
      }
    },
    "inputs": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    },
    "rationale": {
      "type": "string"
    },
    "priority": {
      "type": "string",
      "enum": [
        "high",
        "medium",
        "low"
      ]
    },
    "token_estimate": {
      "type": "number",
      "minimum": 0
    },
    "risk_estimate": {
      "type": "number",
      "minimum": 0,
      "maximum": 1
    },
    "tags": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "minItems": 1
    },
    "status": {
      "type": "string",
      "enum": [
        "pending",
        "complete"
      ]
    },
    "completed_at": {
      "type": "string"
    },
    "completion_reason": {
      "type": "string"
    }
  },
  "required": [
    "task_id",
    "unit_id",
    "pass_id",
    "lens",
    "file_paths",
    "rationale"
  ],
  "additionalProperties": false
}
