{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "user-schedule-plan.v2",
  "title": "OMS exact user schedule plan",
  "type": "object",
  "additionalProperties": false,
  "required": ["schema_version", "manager", "executable_path", "environment_path", "state_root", "workspace_root", "repository", "github_poll_seconds", "jobs"],
  "properties": {
    "schema_version": { "const": 2 },
    "manager": { "type": "string", "enum": ["cron", "systemd", "launchd"] },
    "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 },
    "jobs": {
      "type": "array",
      "minItems": 2,
      "maxItems": 2,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["id", "mode", "interval_seconds", "argv"],
        "properties": {
          "id": { "type": "string", "enum": ["github", "watchdog"] },
          "mode": { "type": "string", "enum": ["poll", "recovery"] },
          "interval_seconds": { "type": "integer", "minimum": 60, "maximum": 3600 },
          "argv": {
            "type": "array",
            "minItems": 8,
            "maxItems": 10,
            "items": { "type": "string", "minLength": 1, "maxLength": 4096 }
          }
        }
      }
    }
  }
}
