{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://grids365.dev/corpus/evaluation/private-case.schema.json",
  "title": "Grid private evaluation case",
  "type": "object",
  "required": [
    "schemaVersion",
    "id",
    "sourceFamilyId",
    "split",
    "taskType",
    "language",
    "languageVersion",
    "messages",
    "oracle",
    "scorers",
    "metadata"
  ],
  "properties": {
    "schemaVersion": { "const": 1 },
    "id": { "$ref": "#/$defs/opaqueId" },
    "sourceFamilyId": { "$ref": "#/$defs/opaqueId" },
    "split": { "enum": ["validation", "test"] },
    "taskType": {
      "enum": ["source-generation", "diagnostic-repair", "expected-output"]
    },
    "language": { "const": "Grid" },
    "languageVersion": {
      "type": "string",
      "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$"
    },
    "messages": {
      "type": "array",
      "minItems": 2,
      "maxItems": 2,
      "prefixItems": [
        { "$ref": "#/$defs/systemMessage" },
        { "$ref": "#/$defs/userMessage" }
      ],
      "items": false
    },
    "oracle": {
      "type": "object",
      "required": ["mediaType", "content", "sha256"],
      "properties": {
        "mediaType": { "enum": ["text/x-grid", "application/json"] },
        "content": { "type": "string", "minLength": 1, "maxLength": 16777216 },
        "sha256": { "$ref": "#/$defs/sha256" }
      },
      "additionalProperties": false
    },
    "scorers": {
      "type": "array",
      "minItems": 1,
      "items": {
        "enum": [
          "compile",
          "compile-optimized",
          "diagnostic-repair",
          "exact-json",
          "exact-source",
          "runtime-observations"
        ]
      },
      "uniqueItems": true
    },
    "metadata": {
      "type": "object",
      "required": ["authorship", "featureIds", "createdAt", "reviewedAt"],
      "properties": {
        "authorship": { "const": "independent-human" },
        "featureIds": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "pattern": "^[a-z0-9]+(?:_[a-z0-9]+)*$"
          },
          "uniqueItems": true
        },
        "createdAt": { "type": "string", "format": "date-time" },
        "reviewedAt": { "type": "string", "format": "date-time" }
      },
      "additionalProperties": false
    }
  },
  "$defs": {
    "opaqueId": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
    "sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
    "message": {
      "type": "object",
      "required": ["role", "content"],
      "properties": {
        "role": { "type": "string" },
        "content": { "type": "string", "minLength": 1 }
      },
      "additionalProperties": false
    },
    "systemMessage": {
      "allOf": [
        { "$ref": "#/$defs/message" },
        {
          "type": "object",
          "properties": {
            "role": { "const": "system" },
            "content": { "const": "Complete the Grid task exactly." }
          }
        }
      ]
    },
    "userMessage": {
      "allOf": [
        { "$ref": "#/$defs/message" },
        { "type": "object", "properties": { "role": { "const": "user" } } }
      ]
    }
  },
  "additionalProperties": false
}
