{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "F76.WORLD Standard Mod & Module Repository Specification",
  "description": "Standardized schema for federated and unofficial Fallout 76 mod repositories (f76-repo-spec-v1).",
  "type": "object",
  "required": ["format_version", "repository", "modules"],
  "properties": {
    "format_version": {
      "type": "string",
      "enum": ["1.0.0", "1.0", "1"]
    },
    "repository": {
      "type": "object",
      "required": ["id", "name", "maintainer"],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9._-]+$",
          "description": "Unique reverse-domain identifier (e.g. org.community.f76qol)"
        },
        "name": {
          "type": "string",
          "minLength": 3,
          "maxLength": 80
        },
        "description": {
          "type": "string",
          "maxLength": 500
        },
        "maintainer": {
          "type": "string",
          "minLength": 2,
          "maxLength": 100
        },
        "website": {
          "type": "string",
          "format": "uri"
        },
        "icon": {
          "type": "string",
          "format": "uri"
        },
        "updated_at": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "modules": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["id", "name", "version", "category", "author", "download_url"],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-z0-9._-]+$",
            "description": "Unique module identifier within this repository"
          },
          "name": {
            "type": "string",
            "minLength": 2,
            "maxLength": 100
          },
          "version": {
            "type": "string",
            "pattern": "^[0-9]+\\.[0-9]+(\\.[0-9]+)?(-[a-zA-Z0-9.]+)?$",
            "description": "Semantic versioning string (e.g. 1.2.0)"
          },
          "category": {
            "type": "string",
            "enum": ["UI", "QoL", "Audio", "Textures", "Scripts", "Tools", "Fixes", "Experimental"]
          },
          "author": {
            "type": "string",
            "minLength": 2,
            "maxLength": 100
          },
          "description": {
            "type": "string",
            "maxLength": 1500
          },
          "homepage": {
            "type": "string",
            "format": "uri"
          },
          "download_url": {
            "type": "string",
            "format": "uri",
            "description": "Direct download link to the mod package (.ba2, .zip, .7z) hosted by the author"
          },
          "sha256": {
            "type": "string",
            "pattern": "^[a-fA-F0-9]{64}$",
            "description": "Cryptographic SHA256 integrity hash"
          },
          "size_bytes": {
            "type": "integer",
            "minimum": 0
          },
          "game_versions": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "default": ["*"]
          },
          "target_install_path": {
            "type": "string",
            "description": "Target relative path in Fallout 76 installation (e.g. Data/InventOMatic.ba2)"
          },
          "ini_tweaks": {
            "type": "array",
            "items": {
              "type": "object",
              "required": ["section", "key", "entry"],
              "properties": {
                "section": {
                  "type": "string",
                  "description": "Target INI section (e.g. Archive, Display, General)"
                },
                "key": {
                  "type": "string",
                  "description": "Target INI key (e.g. sResourceArchive2List)"
                },
                "entry": {
                  "type": "string",
                  "description": "Entry value to set or append"
                },
                "action": {
                  "type": "string",
                  "enum": ["append_comma", "set", "prepend_comma"],
                  "default": "append_comma"
                }
              }
            }
          },
          "dependencies": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "conflicts": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "license": {
            "type": "string"
          },
          "disclaimer": {
            "type": "string"
          }
        }
      }
    }
  }
}
