{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://intelligentliving.art/schemas/model-qualification/v1.json",
  "title": "Living Art Model Qualification Report v1",
  "type": "object",
  "required": [
    "type",
    "version",
    "artwork",
    "suite",
    "configuration",
    "scores",
    "recommendation",
    "review"
  ],
  "properties": {
    "type": {
      "const": "https://intelligentliving.art/protocols/model-qualification/v1.json"
    },
    "version": {
      "const": "1.0.0"
    },
    "artwork": {
      "type": "string",
      "minLength": 1
    },
    "profile": {
      "enum": [
        "local-exhibition",
        "hosted-online",
        "development",
        "other"
      ]
    },
    "suite": {
      "type": "object",
      "required": [
        "id",
        "version",
        "sha256",
        "runCount"
      ],
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1
        },
        "version": {
          "type": "string",
          "minLength": 1
        },
        "sha256": {
          "$ref": "#/$defs/hash"
        },
        "runCount": {
          "type": "integer",
          "minimum": 1
        }
      },
      "additionalProperties": false
    },
    "configuration": {
      "type": "object",
      "required": [
        "models",
        "promptVersion",
        "canonVersion",
        "sourceVersion",
        "retrievalVersion"
      ],
      "properties": {
        "models": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "object",
            "required": [
              "role",
              "provider",
              "model"
            ],
            "properties": {
              "role": {
                "enum": [
                  "answer",
                  "consideration",
                  "vision"
                ]
              },
              "provider": {
                "type": "string",
                "minLength": 1
              },
              "model": {
                "type": "string",
                "minLength": 1
              },
              "quantisation": {
                "type": "string"
              },
              "settings": {
                "type": "object"
              }
            },
            "additionalProperties": false
          }
        },
        "promptVersion": {
          "type": "string",
          "minLength": 1
        },
        "canonVersion": {
          "type": "string",
          "minLength": 1
        },
        "sourceVersion": {
          "type": "string",
          "minLength": 1
        },
        "retrievalVersion": {
          "type": "string",
          "minLength": 1
        }
      },
      "additionalProperties": false
    },
    "scores": {
      "type": "object",
      "minProperties": 1,
      "additionalProperties": {
        "type": "number",
        "minimum": 0,
        "maximum": 100
      }
    },
    "blockingFailures": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "recommendation": {
      "type": "object",
      "required": [
        "status",
        "roles",
        "summary"
      ],
      "properties": {
        "status": {
          "enum": [
            "approved",
            "conditional",
            "rejected",
            "expired"
          ]
        },
        "roles": {
          "type": "array",
          "items": {
            "enum": [
              "answer",
              "consideration",
              "vision"
            ]
          },
          "minItems": 1,
          "uniqueItems": true
        },
        "summary": {
          "type": "string",
          "minLength": 1
        },
        "conditions": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "retestAfter": {
          "type": "string",
          "format": "date"
        }
      },
      "additionalProperties": false
    },
    "review": {
      "type": "object",
      "required": [
        "evaluatedAt",
        "humanReviewed"
      ],
      "properties": {
        "evaluatedAt": {
          "type": "string",
          "format": "date-time"
        },
        "humanReviewed": {
          "type": "boolean"
        },
        "artisticReviewer": {
          "type": "string"
        },
        "notes": {
          "type": "string"
        }
      },
      "additionalProperties": false
    }
  },
  "$defs": {
    "hash": {
      "type": "string",
      "pattern": "^[a-fA-F0-9]{64}$"
    }
  },
  "additionalProperties": false
}
