{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://workspai.dev/schemas/workspace-registry.v1.json",
  "title": "Workspai Workspace Registry Summary",
  "type": "object",
  "required": [
    "schemaVersion",
    "kind",
    "generatedAt",
    "workspacePath",
    "workspaceName",
    "projectCount",
    "authority",
    "contractPath",
    "registrySummaryPath",
    "projects",
    "sources"
  ],
  "properties": {
    "schemaVersion": {
      "const": "workspace-registry.v1"
    },
    "kind": {
      "const": "rapidkit.workspace.registry"
    },
    "generatedAt": {
      "type": "string",
      "format": "date-time"
    },
    "workspacePath": { "type": "string", "minLength": 1 },
    "workspaceName": { "type": "string", "minLength": 1 },
    "profile": { "type": "string" },
    "projectCount": { "type": "integer", "minimum": 0 },
    "authority": {
      "enum": [
        "workspace.contract.json",
        "global-registry",
        "legacy-workspace.json",
        "none"
      ]
    },
    "contractPath": { "type": "string", "minLength": 1 },
    "registrySummaryPath": { "type": "string", "minLength": 1 },
    "projects": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["slug", "relativePath"],
        "properties": {
          "slug": { "type": "string", "minLength": 1 },
          "relativePath": { "type": "string", "minLength": 1 },
          "framework": { "type": "string" },
          "kit": { "type": "string" },
          "source": { "type": "string" }
        },
        "additionalProperties": true
      }
    },
    "sources": {
      "type": "object",
      "required": ["contract", "globalRegistry", "legacyWorkspaceJson"],
      "properties": {
        "contract": { "$ref": "#/$defs/registrySourceSnapshot" },
        "globalRegistry": { "$ref": "#/$defs/registrySourceSnapshot" },
        "legacyWorkspaceJson": { "$ref": "#/$defs/registrySourceSnapshot" }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false,
  "$defs": {
    "registrySourceSnapshot": {
      "type": "object",
      "required": ["exists", "projectCount"],
      "properties": {
        "exists": { "type": "boolean" },
        "projectCount": { "type": "integer", "minimum": 0 },
        "path": { "type": "string" }
      },
      "additionalProperties": false
    }
  }
}
