{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://answerworthy.md/standard/0.1/schema/answerworthy-conformance.schema.json",
  "title": "Answerworthy Conformance Record",
  "description": "Machine-readable self-declared or certified conformance statement for Answerworthy Standard 0.1.",
  "$comment": "SPDX-License-Identifier: Apache-2.0",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "standard_version",
    "conformance_schema_uri",
    "bundle_id",
    "implementation",
    "tested_at",
    "claimed_profiles",
    "profile_results",
    "tests",
    "limitations",
    "certification_state"
  ],
  "properties": {
    "standard_version": { "const": "0.1.0-draft.1" },
    "conformance_schema_uri": { "const": "https://answerworthy.md/standard/0.1/schema/answerworthy-conformance.schema.json" },
    "bundle_id": { "type": "string", "minLength": 1, "maxLength": 240 },
    "bundle_digest": {
      "anyOf": [
        {
          "type": "object",
          "additionalProperties": false,
          "required": ["algorithm", "value"],
          "properties": {
            "algorithm": { "const": "sha256" },
            "value": { "type": "string", "pattern": "^[a-f0-9]{64}$" }
          }
        },
        { "type": "null" }
      ]
    },
    "implementation": {
      "type": "object",
      "additionalProperties": false,
      "required": ["name", "version"],
      "properties": {
        "name": { "type": "string", "minLength": 1, "maxLength": 300 },
        "version": { "type": "string", "minLength": 1, "maxLength": 100 },
        "uri": { "type": "string", "format": "uri" }
      }
    },
    "tested_at": { "type": "string", "format": "date-time" },
    "claimed_profiles": {
      "type": "array",
      "minItems": 1,
      "uniqueItems": true,
      "items": {
        "type": "string",
        "enum": ["core", "agentic", "observed-web", "answer-probe", "outside-buyer", "recheck", "integrity"]
      },
      "contains": { "const": "core" }
    },
    "profile_results": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["profile", "result", "required_tests", "passed_tests", "failed_tests", "incomplete_tests"],
        "properties": {
          "profile": {
            "type": "string",
            "enum": ["core", "agentic", "observed-web", "answer-probe", "outside-buyer", "recheck", "integrity"]
          },
          "result": { "type": "string", "enum": ["pass", "fail", "incomplete", "not_claimed"] },
          "required_tests": { "type": "integer", "minimum": 0 },
          "passed_tests": { "type": "integer", "minimum": 0 },
          "failed_tests": { "type": "integer", "minimum": 0 },
          "incomplete_tests": { "type": "integer", "minimum": 0 }
        }
      }
    },
    "tests": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["test_id", "profile", "result", "message"],
        "properties": {
          "test_id": { "type": "string", "pattern": "^[A-Z]-[0-9]{3}$" },
          "profile": {
            "type": "string",
            "enum": ["core", "agentic", "observed-web", "answer-probe", "outside-buyer", "recheck", "integrity"]
          },
          "result": { "type": "string", "enum": ["pass", "fail", "incomplete", "not_applicable"] },
          "message": { "type": "string", "minLength": 1, "maxLength": 4000 }
        }
      }
    },
    "limitations": {
      "type": "array",
      "items": { "type": "string", "minLength": 1, "maxLength": 4000 }
    },
    "certification_state": {
      "type": "string",
      "enum": ["self_declared", "answerworthy_certified", "not_certified"]
    },
    "certification_reference": { "type": ["string", "null"], "maxLength": 1000 }
  }
}
