{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://turkdini.com/egitim-ogretim/arsiv/data/schema.json",
  "title": "Eğitim-Öğretim Antik Metin Arşivi",
  "description": "Proje alfabelerine bağlı antik yazı/metin kayıtları. Rahim araçsallığı ile genişletilebilir.",
  "type": "object",
  "required": ["schemaVersion", "generatedAt", "entries"],
  "properties": {
    "schemaVersion": { "type": "integer", "const": 1 },
    "generatedAt": { "type": "string", "format": "date-time" },
    "title": { "type": "string" },
    "rahimHook": {
      "type": "string",
      "description": "Rahim araçsallık bildirimi yolu (göreli URL)."
    },
    "entries": {
      "type": "array",
      "items": { "$ref": "#/$defs/entry" }
    }
  },
  "$defs": {
    "entry": {
      "type": "object",
      "required": ["id", "slug", "title", "alphabet", "projectIds", "license"],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$",
          "description": "Kalıcı kimlik (kebab-case)."
        },
        "slug": { "type": "string" },
        "title": { "type": "string" },
        "subtitle": { "type": "string" },
        "alphabet": {
          "type": "string",
          "enum": ["mani", "emperyal-toharya", "phagspa", "eski-uygur"]
        },
        "projectIds": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": ["01", "02", "03", "04", "05", "06", "07", "08"]
          },
          "minItems": 1
        },
        "period": { "type": "string" },
        "scriptDirection": {
          "type": "string",
          "enum": ["rtl", "ltr", "ttb-ltr", "ttb-rtl"]
        },
        "gorsel": {
          "type": "object",
          "description": "Kaynak görseli / faksimile.",
          "properties": {
            "src": { "type": "string" },
            "alt": { "type": "string" },
            "credit": { "type": "string" },
            "license": { "type": "string" }
          }
        },
        "transkripsiyon": {
          "type": "object",
          "description": "Latin / bilimsel transkripsiyon.",
          "properties": {
            "text": { "type": "string" },
            "system": { "type": "string" },
            "notes": { "type": "string" }
          }
        },
        "yaziliBicim": {
          "type": "object",
          "description": "Proje alfabesinde yazılı biçim (Unicode veya ETS).",
          "properties": {
            "text": { "type": "string" },
            "scriptClass": { "type": "string" },
            "unicodeRange": { "type": "string" },
            "notes": { "type": "string" }
          }
        },
        "ceviri": {
          "type": "object",
          "description": "Türkçe çeviri / açıklama.",
          "properties": {
            "tr": { "type": "string" },
            "notes": { "type": "string" }
          }
        },
        "sources": {
          "type": "array",
          "items": {
            "type": "object",
            "required": ["label"],
            "properties": {
              "label": { "type": "string" },
              "url": { "type": "string" },
              "note": { "type": "string" }
            }
          }
        },
        "license": { "type": "string" },
        "tags": {
          "type": "array",
          "items": { "type": "string" }
        },
        "addedAt": { "type": "string", "format": "date" },
        "addedVia": {
          "type": "string",
          "enum": ["seed", "rahim-dialogue", "rahim-research", "manual", "intake-form"],
          "description": "Kaydın arşive giriş kanalı."
        },
        "rahimProposalId": {
          "type": "string",
          "description": "Varsa Rahim diyalog / geri bildirim kodu."
        }
      },
      "additionalProperties": true
    }
  }
}
