{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/schemastore/awesome-repositories/latest.json",
  "title": "Awesome Repositories Configuration Schema",
  "description": "Schema for validating awesome repositories configuration file structure",
  "x-lintel": {
    "source": "https://raw.githubusercontent.com/abordage/schemas/main/schemas/awesome-repositories/awesome-repositories.schema.json",
    "sourceSha256": "c6223e1e05f559b9796c476ad4492c7da553d2dc6bad82dcebdc77664857889a",
    "fileMatch": [
      "awesome-repositories.json",
      "awesome-repositories.yaml",
      "awesome-repositories.yml"
    ],
    "parsers": [
      "json",
      "yaml"
    ]
  },
  "type": "object",
  "properties": {
    "$schema": {
      "type": "string",
      "description": "JSON Schema reference URL"
    },
    "metadata": {
      "type": "object",
      "description": "Metadata about the repositories collection",
      "properties": {
        "version": {
          "type": "string",
          "description": "Version of the repositories collection"
        },
        "author": {
          "type": "string",
          "description": "Author of the repositories collection"
        },
        "description": {
          "type": "string",
          "description": "Description of the repositories collection"
        },
        "created": {
          "type": "string",
          "format": "date",
          "description": "Creation date"
        },
        "updated": {
          "type": "string",
          "format": "date",
          "description": "Last update date"
        }
      },
      "additionalProperties": true
    },
    "categories": {
      "type": "array",
      "description": "List of software categories. Category names must be unique within this array.",
      "items": {
        "$ref": "#/$defs/category"
      },
      "minItems": 1,
      "uniqueItems": true
    }
  },
  "required": [
    "categories"
  ],
  "additionalProperties": false,
  "$defs": {
    "category": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "description": "Category name (must be unique within categories array)",
          "minLength": 1
        },
        "description": {
          "type": "string",
          "description": "Optional category description"
        },
        "repos": {
          "type": "array",
          "description": "List of repositories in this category. Repositories must be unique within this array.",
          "items": {
            "$ref": "#/$defs/repository"
          },
          "minItems": 1,
          "uniqueItems": true
        },
        "subcategories": {
          "type": "array",
          "description": "Optional subcategories. Subcategory names must be unique within this category.",
          "items": {
            "$ref": "#/$defs/subcategory"
          },
          "uniqueItems": true
        }
      },
      "required": [
        "name"
      ],
      "additionalProperties": false
    },
    "subcategory": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "description": "Subcategory name (must be unique within parent category)",
          "minLength": 1
        },
        "description": {
          "type": "string",
          "description": "Optional subcategory description"
        },
        "repos": {
          "type": "array",
          "description": "List of repositories in this subcategory. Repositories must be unique within this array.",
          "items": {
            "$ref": "#/$defs/repository"
          },
          "minItems": 1,
          "uniqueItems": true
        }
      },
      "required": [
        "name",
        "repos"
      ],
      "additionalProperties": false
    },
    "repository": {
      "type": "object",
      "properties": {
        "url": {
          "type": "string",
          "description": "Repository URL",
          "format": "uri",
          "pattern": "^https://github\\.com/[\\w.-]+/[\\w.-]+/?$"
        },
        "name": {
          "type": "string",
          "description": "Optional custom repository name"
        },
        "description": {
          "type": "string",
          "description": "Optional repository description"
        }
      },
      "required": [
        "url"
      ],
      "additionalProperties": false
    }
  }
}
