{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://cbt-cards.github.io/schemas/agent-eval-case-v1.schema.json",
  "title": "CBT Cards agent evaluation case v1",
  "description": "Schema for one line/case in data/agent-evals.jsonl. Cases define expected routing and source-boundary behavior without prescribing exact model wording.",
  "type": "object",
  "required": [
    "schema_version",
    "id",
    "category",
    "user_message",
    "expected_route",
    "expected_resource_ids",
    "expected_source_record_ids",
    "requested_locale",
    "locale_behavior",
    "expected_checks",
    "prohibited_claims",
    "rationale",
    "tags"
  ],
  "properties": {
    "schema_version": {"const": "1.0"},
    "id": {"type": "string", "pattern": "^eval-[a-z0-9][a-z0-9-]*$"},
    "category": {
      "enum": ["retrieval", "learning", "worksheet", "localization", "publication_boundary", "privacy", "safety"]
    },
    "user_message": {"type": "string", "minLength": 1},
    "expected_route": {
      "enum": [
        "published_resource",
        "reviewed_learning",
        "published_worksheet",
        "source_language_resource",
        "explain_status",
        "source_only",
        "no_private_access",
        "host_safety",
        "answer_without_resource"
      ]
    },
    "expected_resource_ids": {
      "type": "array",
      "items": {"type": "string", "pattern": "^[a-z0-9][a-z0-9._-]*$"},
      "uniqueItems": true
    },
    "expected_source_record_ids": {
      "type": "array",
      "items": {"type": "string", "pattern": "^(?:card|metaphor|protocol)-[0-9]+$"},
      "uniqueItems": true
    },
    "requested_locale": {
      "type": ["string", "null"],
      "pattern": "^[a-z]{2}(?:-[A-Z]{2})?$"
    },
    "locale_behavior": {
      "enum": ["none", "source", "official_localization", "host_translation_not_official", "status_only"]
    },
    "expected_checks": {
      "type": "array",
      "minItems": 1,
      "uniqueItems": true,
      "items": {
        "enum": [
          "uses_expected_resource",
          "uses_source_language_resource",
          "preserves_canonical_url",
          "preserves_safety_scope",
          "preserves_worksheet_order",
          "preserves_source_id",
          "does_not_infer_diagnosis",
          "does_not_claim_private_access",
          "does_not_present_machine_draft_as_official",
          "identifies_host_translation",
          "does_not_present_source_only_as_published",
          "does_not_claim_clinical_validation",
          "does_not_turn_source_only_protocol_into_treatment",
          "does_not_route_to_reflection_in_immediate_danger",
          "answers_requested_status"
        ]
      }
    },
    "prohibited_claims": {
      "type": "array",
      "minItems": 1,
      "items": {"type": "string", "minLength": 1}
    },
    "rationale": {"type": "string", "minLength": 1},
    "tags": {
      "type": "array",
      "minItems": 1,
      "uniqueItems": true,
      "items": {"type": "string", "pattern": "^[a-z0-9][a-z0-9-]*$"}
    }
  },
  "additionalProperties": false
}
