{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://graxana.com/schemas/axima-workforce/preflight-v1.schema.json",
  "title": "AximaApp v2 migration preflight v1",
  "type": "object",
  "required": ["contract", "generated_at", "source", "entities", "attachments", "issues", "reconciliation", "summary"],
  "properties": {
    "contract": {
      "type": "object",
      "required": ["name", "schema_version"],
      "properties": {
        "name": {"const": "axima-workforce-migration-bundle"},
        "schema_version": {"const": 1}
      }
    },
    "generated_at": {"type": "string", "format": "date-time"},
    "source": {"type": "object"},
    "entities": {"type": "object"},
    "attachments": {"type": "object"},
    "issues": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["code", "severity", "entity", "source_id", "message", "context"],
        "properties": {
          "code": {"type": "string"},
          "severity": {"enum": ["error", "warning"]},
          "entity": {"type": "string"},
          "source_id": {"type": ["integer", "null"]},
          "message": {"type": "string"},
          "context": {"type": "object"}
        }
      }
    },
    "reconciliation": {"type": "object"},
    "summary": {
      "type": "object",
      "required": ["ready", "error_count", "warning_count", "issue_count"],
      "properties": {
        "ready": {"type": "boolean"},
        "error_count": {"type": "integer", "minimum": 0},
        "warning_count": {"type": "integer", "minimum": 0},
        "issue_count": {"type": "integer", "minimum": 0}
      }
    }
  }
}
