{
	"$schema": "http://json-schema.org/draft-07/schema#",
	"$id": "https://github.com/csark0812/skeleton/schemas/result.schema.json",
	"title": "Skeleton audit result",
	"$ref": "#/$defs/auditResult",
	"$defs": {
		"issue": {
			"type": "object",
			"additionalProperties": false,
			"required": ["rule", "file", "message", "severity"],
			"properties": {
				"rule": { "type": "string", "minLength": 1 },
				"code": { "type": "string", "minLength": 1 },
				"file": { "type": "string", "minLength": 1 },
				"link": { "type": "string" },
				"message": { "type": "string", "minLength": 1 },
				"remediation": { "type": "string", "minLength": 1 },
				"severity": { "enum": ["error", "warning"] }
			}
		},
		"auditResult": {
			"type": "object",
			"additionalProperties": false,
			"required": [
				"schemaVersion",
				"command",
				"ok",
				"exitCode",
				"suite",
				"strict",
				"label",
				"scope",
				"rules",
				"counts",
				"diagnostics",
				"catalog"
			],
			"properties": {
				"schemaVersion": { "const": 1 },
				"command": { "const": "audit" },
				"ok": { "type": "boolean" },
				"exitCode": { "enum": [0, 1] },
				"suite": { "enum": ["docs", "skills", "self"] },
				"strict": { "type": "boolean" },
				"label": { "type": "string" },
				"scope": {
					"type": "object",
					"additionalProperties": false,
					"required": ["paths"],
					"properties": {
						"paths": { "type": "array", "items": { "type": "string" } },
						"fileCount": { "type": "integer", "minimum": 0 }
					}
				},
				"rules": {
					"type": "object",
					"additionalProperties": false,
					"required": ["requested", "executed"],
					"properties": {
						"requested": {
							"oneOf": [{ "type": "null" }, { "type": "array", "items": { "type": "string" } }]
						},
						"executed": { "type": "array", "items": { "type": "string" } }
					}
				},
				"counts": {
					"type": "object",
					"additionalProperties": false,
					"required": ["errors", "warnings"],
					"properties": {
						"errors": { "type": "integer", "minimum": 0 },
						"warnings": { "type": "integer", "minimum": 0 }
					}
				},
				"diagnostics": { "type": "array", "items": { "$ref": "#/$defs/issue" } },
				"catalog": {
					"type": "object",
					"additionalProperties": false,
					"required": ["status"],
					"properties": {
						"status": {
							"enum": ["current", "missing", "stale", "skipped-ci", "not-applicable"]
						}
					}
				},
				"successSuffix": { "type": "string" }
			}
		}
	}
}
