{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "BackfocusLab result handoff",
  "$id": "https://backfocuslab.com/schemas/result.schema.json",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schemaVersion",
    "product",
    "methodVersion",
    "plan",
    "units",
    "result",
    "limitations"
  ],
  "properties": {
    "schemaVersion": {
      "const": 1
    },
    "product": {
      "const": "astronomy-equipment-compatibility"
    },
    "methodVersion": {
      "type": "string"
    },
    "plan": {
      "$ref": "plan.schema.json"
    },
    "units": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    },
    "limitations": {
      "type": "string"
    },
    "result": {
      "type": "object",
      "required": [
        "raw",
        "checks",
        "status",
        "connections",
        "metrics",
        "sections",
        "notes",
        "warnings"
      ],
      "properties": {
        "raw": {
          "type": "object",
          "additionalProperties": {
            "type": [
              "number",
              "boolean"
            ]
          }
        },
        "status": {
          "type": "object",
          "required": [
            "tone",
            "title",
            "body"
          ]
        },
        "checks": {
          "type": "array",
          "minItems": 4,
          "maxItems": 4,
          "items": {
            "type": "object",
            "required": [
              "key",
              "label",
              "status",
              "target",
              "detail"
            ],
            "properties": {
              "status": {
                "enum": [
                  "pass",
                  "review",
                  "unknown"
                ]
              }
            }
          }
        },
        "connections": {
          "type": "array"
        },
        "metrics": {
          "type": "array"
        },
        "sections": {
          "type": "array"
        },
        "notes": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "warnings": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    }
  }
}
