{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "user-schedule-installation.v2",
  "title": "OMS exact user schedule installation",
  "type": "object",
  "additionalProperties": false,
  "required": ["schema_version", "manager", "plan_sha256", "executable_path", "environment_path", "state_root", "workspace_root", "repository", "github_poll_seconds", "manager_executable_path", "home_directory", "user_id", "installed_at", "artifacts"],
  "properties": {
    "schema_version": { "const": 2 },
    "manager": { "type": "string", "enum": ["cron", "systemd", "launchd"] },
    "plan_sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
    "executable_path": { "type": "string", "minLength": 2, "maxLength": 4096 },
    "environment_path": { "type": "string", "minLength": 1, "maxLength": 16384 },
    "state_root": { "type": "string", "minLength": 2, "maxLength": 4096 },
    "workspace_root": { "type": "string", "minLength": 2, "maxLength": 4096 },
    "repository": { "type": "string", "pattern": "^[a-z0-9][a-z0-9-]{0,38}/[a-z0-9._-]{1,100}$" },
    "github_poll_seconds": { "type": "integer", "minimum": 60, "maximum": 3600 },
    "manager_executable_path": { "type": "string", "minLength": 2, "maxLength": 4096 },
    "home_directory": { "type": "string", "minLength": 2, "maxLength": 4096 },
    "user_id": { "type": ["integer", "null"], "minimum": 0 },
    "installed_at": { "type": "string", "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]{3}Z$" },
    "artifacts": {
      "type": "array",
      "minItems": 1,
      "maxItems": 6,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["relative_path", "installed_path", "sha256"],
        "properties": {
          "relative_path": { "type": "string", "minLength": 1, "maxLength": 128 },
          "installed_path": { "type": ["string", "null"], "minLength": 2, "maxLength": 4096 },
          "sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" }
        }
      }
    }
  }
}
