{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://edpol.pro/schemas/editorial-case.schema.json",
  "title": "Editorial case dossier",
  "description": "CMS-owned dossier for one reviewed article revision. Edpol publishes this schema but does not store case data.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "caseId",
    "articleId",
    "projectId",
    "policyVersion",
    "contentFingerprint",
    "riskLevel",
    "claims",
    "evidence",
    "checks",
    "decision",
    "updatedAt"
  ],
  "properties": {
    "caseId": {"type": "string", "pattern": "^[a-z0-9][a-z0-9._:-]{1,127}$"},
    "articleId": {"type": "string", "minLength": 1, "maxLength": 256},
    "projectId": {"type": "string", "pattern": "^[a-z0-9._-]+$"},
    "policyVersion": {"type": "string", "minLength": 1, "maxLength": 64},
    "contentFingerprint": {"type": "string", "pattern": "^sha256:[a-f0-9]{64}$"},
    "riskLevel": {"enum": ["P0", "P1", "P2"]},
    "claims": {
      "type": "array",
      "minItems": 1,
      "maxItems": 100,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["claimId", "text", "language"],
        "properties": {
          "claimId": {"type": "string", "pattern": "^[a-z0-9][a-z0-9._:-]{1,127}$"},
          "text": {"type": "string", "minLength": 1, "maxLength": 5000},
          "language": {"enum": ["ru", "kk", "en", "other"]},
          "sourceLocator": {"type": "string", "maxLength": 500}
        }
      }
    },
    "evidence": {
      "type": "array",
      "maxItems": 200,
      "items": {"$ref": "https://edpol.pro/schemas/evidence-reference.schema.json"}
    },
    "analysis": {"type": "string", "maxLength": 20000},
    "limitations": {"type": "string", "maxLength": 5000},
    "reviewerIds": {
      "type": "array",
      "items": {"type": "string", "minLength": 1, "maxLength": 256},
      "uniqueItems": true,
      "maxItems": 50
    },
    "checks": {
      "type": "object",
      "additionalProperties": false,
      "required": ["sourceReview", "rightOfReply", "legalReview", "privacyReview", "rightsReview", "languageParity", "aiDisclosure"],
      "properties": {
        "sourceReview": {"enum": ["pending", "verified", "blocked"]},
        "rightOfReply": {"enum": ["not-applicable", "pending", "requested", "received", "declined", "blocked"]},
        "legalReview": {"enum": ["not-applicable", "pending", "approved", "blocked"]},
        "privacyReview": {"enum": ["not-applicable", "pending", "approved", "blocked"]},
        "rightsReview": {"enum": ["not-applicable", "pending", "approved", "blocked"]},
        "languageParity": {"enum": ["not-applicable", "pending", "verified", "blocked"]},
        "aiDisclosure": {"enum": ["not-used", "assisted-disclosed", "synthetic-labeled", "review-required"]}
      }
    },
    "decision": {"enum": ["draft", "needs-evidence", "needs-review", "ready", "blocked"]},
    "reasonCodes": {
      "type": "array",
      "items": {"type": "string", "pattern": "^[a-z0-9._-]+$"},
      "uniqueItems": true,
      "maxItems": 50
    },
    "updatedAt": {"type": "string", "format": "date-time"}
  }
}
