{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://law.arxo.io/schema/priority-conflict-graph.schema.json",
  "title": "Arxo law priority conflict graph answer 0.1",
  "description": "Graph of only direct priority rules from the lowered compiler snapshot. The `conflicts` field does not replace a case evaluation.",
  "type": "object",
  "additionalProperties": false,
  "required": ["schema", "uri", "version", "status"],
  "properties": {
    "schema": { "const": "law.priority-conflict-graph/0.1" },
    "uri": { "type": "string", "pattern": "^file://" },
    "version": { "type": "integer" },
    "status": { "enum": ["available", "unavailable"] },
    "reason": { "type": "string", "minLength": 1 },
    "nodes": { "type": "array", "items": { "type": "string", "minLength": 1 }, "uniqueItems": true },
    "priorityEdges": {
      "type": "array",
      "items": {
        "type": "object", "additionalProperties": false,
        "required": ["id", "higher", "lower"],
        "properties": {
          "id": { "type": "string", "minLength": 1 },
          "higher": { "type": "string", "minLength": 1 },
          "lower": { "type": "string", "minLength": 1 },
          "reason": { "type": "string", "minLength": 1 }
        }
      }
    },
    "conflicts": {
      "type": "object", "additionalProperties": false,
      "required": ["status", "reason"],
      "properties": {
        "status": { "const": "unavailable" },
        "reason": { "type": "string", "minLength": 1 }
      }
    }
  },
  "allOf": [
    { "if": { "properties": { "status": { "const": "available" } } }, "then": { "required": ["nodes", "priorityEdges", "conflicts"] } },
    { "if": { "properties": { "status": { "const": "unavailable" } } }, "then": { "required": ["reason"] } }
  ]
}
