{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/arm/topo-project-catalog/main/data/catalog.schema.json",
  "title": "Topo Project Catalog",
  "description": "A catalog of Topo Project repositories.",
  "type": "object",
  "additionalProperties": false,
  "required": ["projects"],
  "properties": {
    "$schema": {
      "description": "Schema URL for editor and tooling discovery.",
      "type": "string",
      "const": "https://raw.githubusercontent.com/arm/topo-project-catalog/main/data/catalog.schema.json"
    },
    "projects": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/project"
      }
    }
  },
  "$defs": {
    "parameter": {
      "type": "object",
      "description": "Parameter definition.",
      "additionalProperties": false,
      "properties": {
        "description": {
          "type": "string",
          "description": "Context displayed in user prompts."
        },
        "required": {
          "type": "boolean",
          "description": "If true, implementations must enforce input or error."
        },
        "default": {
          "type": "string",
          "description": "Value used if user skips input (only valid when not required)."
        },
        "example": {
          "type": "string",
          "description": "Hint text displayed in help and prompts."
        },
        "hints": {
          "type": "object",
          "description": "Advisory metadata that implementations may use to discover, filter, or suggest suitable parameter values. Unknown hint keys should be ignored.",
          "patternProperties": {
            "^[a-z][a-z0-9-]*(\\.[a-z][a-z0-9-]*)+$": {
              "oneOf": [
                {
                  "type": ["string", "number", "boolean"]
                },
                {
                  "type": "array",
                  "items": {
                    "type": ["string", "number", "boolean"]
                  }
                }
              ]
            }
          },
          "additionalProperties": false
        }
      }
    },
    "project": {
      "type": "object",
      "additionalProperties": false,
      "required": ["name", "description", "url", "ref"],
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1
        },
        "description": {
          "type": "string"
        },
        "features": {
          "description": "Optional list of hardware, runtime, or platform features used by the project.",
          "oneOf": [
            {
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1
              },
              "uniqueItems": true
            },
            {
              "type": "null"
            }
          ]
        },
        "parameters": {
          "description": "Optional dictionary of parameter definitions used for parameterized projects.",
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/parameter"
          }
        },
        "url": {
          "description": "Repository URL containing the project. This URL is the stable source identifier used to match catalog entries to configured sources.",
          "type": "string",
          "format": "uri"
        },
        "ref": {
          "description": "Git ref to use when fetching the project repository.",
          "type": "string",
          "minLength": 1
        }
      }
    }
  }
}
