{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.lilithverse.fr/market/mod-manifest.schema.json",
  "title": "Lilith Mod Manifest",
  "description": "Contrat déclaratif v0.1. Le runtime de mods et les téléversements publics ne sont pas encore actifs.",
  "type": "object",
  "additionalProperties": false,
  "required": ["schemaVersion", "id", "name", "version", "game", "compatibility", "content", "permissions"],
  "properties": {
    "schemaVersion": {
      "const": 1
    },
    "id": {
      "type": "string",
      "pattern": "^[a-z0-9][a-z0-9.-]{2,79}$"
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 80
    },
    "version": {
      "type": "string",
      "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+(?:-[0-9A-Za-z.-]+)?$"
    },
    "author": {
      "type": "string",
      "minLength": 1,
      "maxLength": 80
    },
    "game": {
      "enum": ["lilith-wars"]
    },
    "compatibility": {
      "type": "object",
      "additionalProperties": false,
      "required": ["minimumGameVersion"],
      "properties": {
        "minimumGameVersion": {
          "type": "string",
          "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$"
        },
        "maximumGameVersion": {
          "type": "string",
          "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$"
        }
      }
    },
    "dependencies": {
      "type": "array",
      "maxItems": 32,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["id", "version"],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9.-]{2,79}$"
          },
          "version": {
            "type": "string",
            "maxLength": 32
          }
        }
      }
    },
    "content": {
      "type": "array",
      "minItems": 1,
      "maxItems": 128,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["type", "path"],
        "properties": {
          "type": {
            "enum": ["balance", "localization", "scenario", "visual"]
          },
          "path": {
            "type": "string",
            "pattern": "^(?!/)(?!.*\\.\\.)(?!.*\\\\)[a-zA-Z0-9_./-]{1,180}$"
          }
        }
      }
    },
    "permissions": {
      "type": "array",
      "uniqueItems": true,
      "items": {
        "enum": ["read-game-data", "write-mod-save", "replace-localization", "replace-visual-assets"]
      }
    }
  }
}
