{
  "$schema": "https://json-schema.org/draft-07/schema#",
  "$id": "https://local/governance/docs-publish/schemas/content-type.schema.json",
  "title": "Documentation Content Type",
  "description": "Normalized schema for any documentation output produced by the Documentation Agent.",
  "type": "object",
  "required": [
    "content_type",
    "version",
    "source_references",
    "audience",
    "intent",
    "metadata",
    "quality_checklist"
  ],
  "additionalProperties": false,
  "properties": {
    "content_type": {
      "type": "string",
      "description": "Identifier matching a template in templates/ (e.g., 'technical-doc', 'narrative-article')."
    },
    "version": { "type": "string", "description": "SemVer of the content type schema." },
    "source_references": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["kind", "ref"],
        "properties": {
          "kind": { "type": "string", "enum": ["repo", "wiki", "anytype", "url", "file", "transcript", "test_run"] },
          "ref": { "type": "string", "description": "Path / id / URL / object id." },
          "rev": { "type": "string", "description": "Optional commit, version, or timestamp pinning." }
        },
        "additionalProperties": false
      },
      "minItems": 1
    },
    "audience": {
      "type": "string",
      "description": "Who this content is written for (e.g., 'engineering-internal', 'public-tutorial-readers')."
    },
    "intent": {
      "type": "string",
      "enum": ["explain", "instruct", "persuade", "narrate", "teach", "demo"]
    },
    "metadata": {
      "type": "object",
      "required": ["title", "data_classification", "owners"],
      "properties": {
        "title": { "type": "string" },
        "subtitle": { "type": "string" },
        "data_classification": {
          "type": "string",
          "enum": ["private_sensitive", "internal", "low_sensitive"]
        },
        "owners": { "type": "array", "items": { "type": "string" } },
        "language": { "type": "string", "default": "en" },
        "keywords": { "type": "array", "items": { "type": "string" } }
      }
    },
    "quality_checklist": {
      "type": "object",
      "required": ["editorial", "technical_accuracy", "safety"],
      "properties": {
        "editorial": { "type": "boolean", "default": false },
        "technical_accuracy": { "type": "boolean", "default": false },
        "safety": { "type": "boolean", "default": false },
        "citations_complete": { "type": "boolean", "default": false },
        "no_unverified_claims": { "type": "boolean", "default": false }
      }
    },
    "publication_metadata": {
      "type": "object",
      "description": "Filled by Publishing Agent when packaging for a specific venue.",
      "properties": {
        "selected_venue": { "type": "string" },
        "venue_specific_fields": { "type": "object", "additionalProperties": true },
        "approval_record": {
          "type": "object",
          "properties": {
            "approver": { "type": "string" },
            "approved_at": { "type": "string", "format": "date-time" }
          }
        }
      }
    }
  }
}
