{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://stateofai/statebench/native_eval_fixture_v1.schema.json",
  "title": "NativeEvalFixtureV1",
  "description": "Pinned native eval framework payload fixture used to verify adapter boundaries before normalization into StateBench contracts.",
  "type": "object",
  "required": [
    "schema_version",
    "fixture_id",
    "framework",
    "framework_version",
    "fixture_type",
    "native_grain",
    "primary_source_refs",
    "payload",
    "adapter_expectations",
    "created_at_utc"
  ],
  "additionalProperties": false,
  "allOf": [
    {
      "if": {
        "properties": {
          "fixture_type": {"const": "real_run_export"}
        },
        "required": ["fixture_type"]
      },
      "then": {
        "properties": {
          "raw_payload_hash": {
            "type": "string",
            "pattern": "^sha256:[0-9a-f]{64}$"
          }
        },
        "required": ["raw_payload_hash"]
      }
    }
  ],
  "properties": {
    "schema_version": {"const": "native_eval_fixture_v1"},
    "fixture_id": {"type": "string"},
    "framework": {"type": "string"},
    "framework_version": {"type": "string"},
    "fixture_type": {
      "type": "string",
      "enum": ["source_observed_contract", "real_run_export", "documentation_example"]
    },
    "native_grain": {"type": "string"},
    "primary_source_refs": {
      "type": "array",
      "items": {"type": "string"},
      "minItems": 1,
      "uniqueItems": true
    },
    "source_retrieved_at": {"type": ["string", "null"], "format": "date"},
    "payload": {
      "type": "object",
      "description": "Native framework payload. Shape is intentionally framework-owned."
    },
    "adapter_expectations": {
      "type": "object",
      "required": ["maps_to", "required_native_fields", "normalization_notes"],
      "additionalProperties": false,
      "properties": {
        "maps_to": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "eval_case_v1",
              "eval_result_v1",
              "trace_ref_v1",
              "source_bundle_v1",
              "golden_work_packet_v1",
              "training_example_v1",
              "gitlab_eval_annotation_v1"
            ]
          },
          "minItems": 1,
          "uniqueItems": true
        },
        "required_native_fields": {
          "type": "array",
          "items": {"type": "string"},
          "minItems": 1,
          "uniqueItems": true
        },
        "optional_native_fields": {
          "type": "array",
          "items": {"type": "string"},
          "uniqueItems": true
        },
        "normalization_notes": {"type": "string"},
        "known_limitations": {
          "type": "array",
          "items": {"type": "string"},
          "uniqueItems": true
        }
      }
    },
    "raw_payload_hash": {
      "type": ["string", "null"],
      "pattern": "^sha256:[0-9a-f]{64}$"
    },
    "created_at_utc": {"type": "string", "format": "date-time"}
  }
}
