{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://nodedc.ru/schemas/application-manifest-v0.1.schema.json",
  "title": "NODE.DC Application Manifest v0.1",
  "type": "object",
  "additionalProperties": false,
  "required": ["schemaVersion", "id", "status", "version", "metadata", "designProfile", "pages", "favicon", "timestamps"],
  "properties": {
    "schemaVersion": { "const": "0.1.0" },
    "id": { "type": "string", "format": "uuid" },
    "status": { "const": "draft" },
    "version": { "type": "string", "pattern": "^0\\.[0-9]+\\.[0-9]+$" },
    "metadata": {
      "type": "object",
      "additionalProperties": false,
      "required": ["name", "slug", "description"],
      "properties": {
        "name": { "type": "string", "minLength": 1, "maxLength": 120 },
        "slug": { "type": "string", "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$", "maxLength": 64 },
        "description": { "type": "string", "maxLength": 500 }
      }
    },
    "designProfile": {
      "type": "object",
      "additionalProperties": false,
      "required": ["id", "version", "status", "theme"],
      "properties": {
        "id": { "type": "string", "minLength": 1 },
        "version": { "type": "string", "minLength": 1 },
        "status": { "enum": ["draft", "published"] },
        "theme": { "enum": ["dark", "light"] }
      }
    },
    "pages": {
      "type": "array",
      "minItems": 0,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["id", "title", "path", "template", "navigation", "features"],
        "properties": {
          "id": { "type": "string", "pattern": "^[a-z0-9-]+$" },
          "title": { "type": "string", "minLength": 1 },
          "path": { "type": "string", "minLength": 1 },
          "template": {
            "type": "object",
            "additionalProperties": false,
            "required": ["id", "version"],
            "properties": {
              "id": { "type": "string", "minLength": 1 },
              "version": { "type": "string", "minLength": 1 }
            }
          },
          "navigation": {
            "type": "object",
            "additionalProperties": false,
            "required": ["visible", "label", "order"],
            "properties": {
              "visible": { "type": "boolean" },
              "label": { "type": "string" },
              "order": { "type": "integer", "minimum": 0 }
            }
          },
          "features": {
            "type": "object",
            "additionalProperties": { "type": "boolean" }
          }
        }
      }
    },
    "favicon": {
      "type": "object",
      "additionalProperties": false,
      "required": ["source"],
      "properties": {
        "source": { "const": "design-profile" }
      }
    },
    "timestamps": {
      "type": "object",
      "additionalProperties": false,
      "required": ["createdAt", "updatedAt"],
      "properties": {
        "createdAt": { "type": "string", "format": "date-time" },
        "updatedAt": { "type": "string", "format": "date-time" }
      }
    }
  }
}
