{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://ateeducacion.github.io/moodle-playground/assets/blueprints/blueprint-schema.json",
  "title": "Moodle Playground Blueprint",
  "description": "Step-based blueprint for provisioning a Moodle Playground instance.",
  "type": "object",
  "properties": {
    "$schema": {
      "type": "string"
    },
    "preferredVersions": {
      "type": "object",
      "properties": {
        "php": { "type": "string" },
        "moodle": { "type": "string" }
      },
      "additionalProperties": true
    },
    "landingPage": {
      "type": "string",
      "pattern": "^/"
    },
    "constants": {
      "type": "object",
      "additionalProperties": { "type": "string" }
    },
    "phpConstants": {
      "type": "object",
      "description": "PHP constants defined in config.php (guarded by !defined and emitted before lib/setup.php) so a plugin blueprint can enable plugin-specific behaviour without the engine knowing the constant names.",
      "propertyNames": { "pattern": "^[A-Z_][A-Z0-9_]*$" },
      "additionalProperties": { "type": ["boolean", "string", "number"] }
    },
    "resources": {
      "type": "object",
      "additionalProperties": {
        "type": "object",
        "properties": {
          "url": { "type": "string" },
          "base64": { "type": "string" },
          "data-url": { "type": "string" },
          "bundled": { "type": "string" },
          "vfs": { "type": "string" },
          "literal": {}
        }
      }
    },
    "runtime": {
      "type": "object",
      "description": "Runtime configuration options applied at boot time via config.php.",
      "properties": {
        "debug": {
          "type": "integer",
          "enum": [0, 5, 15, 32767],
          "default": 0,
          "description": "Initial Moodle debug level stored in config on boot. Editable later from Moodle administration. 0=NONE, 5=MINIMAL, 15=NORMAL, 32767=DEVELOPER."
        },
        "debugdisplay": {
          "type": "integer",
          "enum": [0, 1],
          "default": 0,
          "description": "Whether to display debug messages on page (1) or only log them (0)."
        }
      },
      "additionalProperties": true
    },
    "steps": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["step"],
        "properties": {
          "step": {
            "type": "string",
            "enum": [
              "installMoodle",
              "setAdminAccount",
              "login",
              "setConfig",
              "setConfigs",
              "setConfigFile",
              "setConfigFiles",
              "setTheme",
              "setLandingPage",
              "createUser",
              "createUsers",
              "createCategory",
              "createCategories",
              "createCourse",
              "createCourses",
              "createSection",
              "createSections",
              "enrolUser",
              "enrolUsers",
              "addModule",
              "restoreCourse",
              "createRole",
              "createRoles",
              "importRolePreset",
              "importRoles",
              "createScale",
              "createScales",
              "createCohort",
              "createCohorts",
              "installMoodlePlugin",
              "installTheme",
              "installLanguagePack",
              "mkdir",
              "rmdir",
              "writeFile",
              "writeFiles",
              "copyFile",
              "moveFile",
              "deleteFile",
              "deleteFiles",
              "unzip",
              "request",
              "runPhpCode",
              "runPhpScript",
              "purgeMoodleCaches",
              "applyPrOverlay"
            ]
          }
        },
        "additionalProperties": true
      }
    }
  },
  "required": ["steps"],
  "additionalProperties": true
}
