{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://schemas.elastic-print.io/hdm-metadata/1",
  "title": ".hdm-metadata.yml",
  "description": "Schema for validating HDM metadata YAML files",
  "type": "object",
  "required": ["schema", "responsible", "gitlab"],
  "properties": {
    "schema": {
      "type": "object",
      "required": ["name", "version"],
      "properties": {
        "name": {
          "type": "string",
          "const": "hdm-metadata",
          "description": "The schema name must be 'hdm-metadata'"
        },
        "version": {
          "type": "integer",
          "minimum": 1,
          "description": "The schema version number"
        }
      },
      "additionalProperties": false
    },
    "responsible": {
      "type": "object",
      "required": ["persons"],
      "properties": {
        "persons": {
          "type": "array",
          "minItems": 1,
          "description": "List of responsible persons (at least one required)",
          "items": {
            "type": "string",
            "format": "email",
            "pattern": "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$",
            "description": "Valid email address"
          }
        },
        "teams": {
          "type": "array",
          "description": "List of responsible teams (optional)",
          "items": {
            "type": "string",
            "minLength": 1
          }
        }
      },
      "additionalProperties": false
    },
    "gitlab": {
      "type": "object",
      "description": "Optional GitLab-specific metadata.",
      "required": ["project_id"],
      "properties": {
        "project_id": {
          "type": "integer",
          "minimum": 1,
          "description": "GitLab project ID."
        },
        "project_url": {
          "type": "string",
          "format": "uri",
          "minLength": 1,
          "description": "Optional GitLab project URL."
        },
        "topics": {
          "type": "array",
          "description": "Optional list of GitLab repository topics.",
          "items": {
            "type": "string",
            "minLength": 1
          }
        }
      },
      "additionalProperties": false
    },
    "sonarqube": {
      "type": "object",
      "description": "Optional SonarQube-specific metadata.",
      "properties": {
        "project_key": {
          "type": "string",
          "minLength": 1,
          "description": "Optional SonarQube project key."
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
