{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.gailabai.com/schemas/gaialab-external-model-submission-v1.schema.json",
  "title": "GaiaLab External Model Prospective Submission v1",
  "type": "object",
  "required": [
    "schemaVersion",
    "studyId",
    "model",
    "evidenceCutoff",
    "outcomeBoundary",
    "endpoint",
    "predictions",
    "hashes"
  ],
  "properties": {
    "schemaVersion": {
      "const": "gaialab.external-model-submission.v1"
    },
    "studyId": {
      "type": "string",
      "minLength": 3
    },
    "model": {
      "type": "object",
      "required": [
        "name",
        "version",
        "owner"
      ],
      "properties": {
        "name": {
          "type": "string"
        },
        "version": {
          "type": "string"
        },
        "owner": {
          "type": "string"
        },
        "provider": {
          "type": [
            "string",
            "null"
          ]
        },
        "codeCommit": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "evidenceCutoff": {
      "type": "string",
      "format": "date-time"
    },
    "outcomeBoundary": {
      "type": "object",
      "required": [
        "availableAt",
        "source"
      ],
      "properties": {
        "availableAt": {
          "type": "string",
          "format": "date-time"
        },
        "source": {
          "type": "string",
          "minLength": 3
        }
      }
    },
    "endpoint": {
      "type": "object",
      "required": [
        "name",
        "definition",
        "scoreRule"
      ],
      "properties": {
        "name": {
          "type": "string"
        },
        "definition": {
          "type": "string"
        },
        "scoreRule": {
          "type": "object"
        }
      }
    },
    "predictions": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": [
          "predictionId",
          "claim",
          "score"
        ],
        "properties": {
          "predictionId": {
            "type": "string"
          },
          "claim": {
            "type": "string",
            "minLength": 5
          },
          "score": {
            "type": "number"
          },
          "context": {
            "type": "object"
          },
          "abstain": {
            "type": "boolean"
          }
        }
      }
    },
    "hashes": {
      "type": "object",
      "required": [
        "predictionsSha256",
        "manifestSha256"
      ],
      "properties": {
        "predictionsSha256": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "manifestSha256": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        }
      }
    }
  },
  "additionalProperties": false
}