{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.michaeldariuseastwood.com/schemas/status-benchmark-policy.schema.json",
  "title": "Status and benchmark policy",
  "type": "object",
  "additionalProperties": false,
  "required": ["schemaVersion", "policyId", "dateModified", "description", "runtime", "sources", "benchmark", "supabase", "outputs"],
  "properties": {
    "schemaVersion": {"const": 1},
    "policyId": {"type": "string", "minLength": 1},
    "dateModified": {"type": "string", "format": "date"},
    "description": {"type": "string", "minLength": 1},
    "runtime": {
      "type": "object",
      "additionalProperties": false,
      "required": ["nodeMajor", "networkAccess", "externalModelCalls"],
      "properties": {
        "nodeMajor": {"type": "integer", "minimum": 22},
        "networkAccess": {"const": false},
        "externalModelCalls": {"const": false}
      }
    },
    "sources": {
      "type": "object",
      "minProperties": 1,
      "additionalProperties": {"type": "string", "minLength": 1}
    },
    "benchmark": {
      "type": "object",
      "additionalProperties": false,
      "required": ["topK", "titleExactPhraseBoost", "titleTokenBoost", "bodyTokenBoost", "topicBoost", "minimumHitAt5", "minimumMeanReciprocalRank", "gateMode"],
      "properties": {
        "topK": {"type": "integer", "minimum": 1, "maximum": 50},
        "titleExactPhraseBoost": {"type": "number", "minimum": 0},
        "titleTokenBoost": {"type": "number", "minimum": 0},
        "bodyTokenBoost": {"type": "number", "minimum": 0},
        "topicBoost": {"type": "number", "minimum": 0},
        "minimumHitAt5": {"type": "number", "minimum": 0, "maximum": 1},
        "minimumMeanReciprocalRank": {"type": "number", "minimum": 0, "maximum": 1},
        "gateMode": {"const": "hard-for-corpus-integrity-report-targets"}
      }
    },
    "supabase": {
      "type": "object",
      "additionalProperties": false,
      "required": ["project", "projectId", "runTable", "resultTable", "access"],
      "properties": {
        "project": {"type": "string", "minLength": 1},
        "projectId": {"type": "string", "pattern": "^[a-z]{20}$"},
        "runTable": {"type": "string", "pattern": "^[a-z][a-z0-9_]*$"},
        "resultTable": {"type": "string", "pattern": "^[a-z][a-z0-9_]*$"},
        "access": {"const": "authenticated-owner-only"}
      }
    },
    "outputs": {
      "type": "object",
      "additionalProperties": false,
      "required": ["buildStatus", "testStatus", "contentIntegrity", "benchmark", "benchmarkResults"],
      "properties": {
        "buildStatus": {"type": "string", "minLength": 1},
        "testStatus": {"type": "string", "minLength": 1},
        "contentIntegrity": {"type": "string", "minLength": 1},
        "benchmark": {"type": "string", "minLength": 1},
        "benchmarkResults": {"type": "string", "minLength": 1}
      }
    }
  }
}
