{
	"$schema": "http://json-schema.org/draft-07/schema#",
	"$id": "https://github.com/csark0812/skeleton/schemas/policy-file.schema.json",
	"title": "Policy File",
	"type": "object",
	"required": ["name", "entries"],
	"additionalProperties": false,
	"properties": {
		"name": {
			"type": "string",
			"description": "Policy set id (matches filename stem)"
		},
		"entries": {
			"type": "array",
			"minItems": 1,
			"items": { "$ref": "#/$defs/policyEntry" }
		}
	},
	"$defs": {
		"policyEntry": {
			"type": "object",
			"required": ["id", "message"],
			"additionalProperties": false,
			"properties": {
				"id": { "type": "string" },
				"mode": { "enum": ["pattern", "fingerprint"] },
				"pattern": { "type": "string" },
				"message": { "type": "string" },
				"scope": { "type": "string" },
				"severity": { "enum": ["error", "warning"] },
				"canonical": { "type": "string" },
				"caseSensitive": { "type": "boolean" },
				"placement": { "enum": ["any", "draft-only"] },
				"handledBy": { "type": "string", "minLength": 1 }
			},
			"if": {
				"properties": { "mode": { "const": "fingerprint" } },
				"required": ["mode"]
			},
			"then": { "required": ["handledBy"] },
			"else": { "required": ["pattern"] }
		}
	}
}
