{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://qaatlas.dev/schemas/coverage.schema.json",
  "title": "QAAtlas Coverage Map",
  "description": "Schema for QAAtlas coverage map output",
  "type": "object",
  "required": ["version", "generatedAt", "files", "summary"],
  "properties": {
    "version": {
      "type": "string",
      "description": "Schema version"
    },
    "generatedAt": {
      "type": "string",
      "format": "date-time",
      "description": "ISO8601 timestamp when coverage map was generated"
    },
    "files": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["filePath", "changedLines", "relatedTests", "coverageStatus", "uncoveredAreas"],
        "properties": {
          "filePath": {
            "type": "string",
            "description": "Path to the source file"
          },
          "changedLines": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "description": "Line numbers that were changed"
          },
          "relatedTests": {
            "type": "array",
            "items": {
              "type": "object",
              "required": ["testId", "testTitle", "type"],
              "properties": {
                "testId": {
                  "type": "string",
                  "description": "Test case ID"
                },
                "testTitle": {
                  "type": "string",
                  "description": "Test case title"
                },
                "type": {
                  "type": "string",
                  "enum": ["unit", "integration", "e2e", "regression", "smoke", "performance", "security", "manual"]
                }
              }
            }
          },
          "coverageStatus": {
            "type": "string",
            "enum": ["full", "partial", "none", "unknown"],
            "description": "Coverage status for this file"
          },
          "uncoveredAreas": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Description of areas not covered by tests"
          }
        }
      }
    },
    "summary": {
      "type": "object",
      "required": ["totalFiles", "fullyCovered", "partiallyCovered", "notCovered", "unknown"],
      "properties": {
        "totalFiles": {
          "type": "integer",
          "minimum": 0
        },
        "fullyCovered": {
          "type": "integer",
          "minimum": 0
        },
        "partiallyCovered": {
          "type": "integer",
          "minimum": 0
        },
        "notCovered": {
          "type": "integer",
          "minimum": 0
        },
        "unknown": {
          "type": "integer",
          "minimum": 0
        }
      }
    }
  }
}
