{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "anu_v3/schemas/generic_batch_plan.schema.json",
  "title": "anu_v3.generic_batch_plan.v0",
  "description": "task-2553+30 TRACK B. Generic parallel batch plan consumed by anu_v3.generic_batch_coordinator. Generalizes parallel_batch_coordinator v0: any number of tracks, each carrying its callback 4-tuple, dependency/overlap declarations, runtime observation (result/.done existence — NO-CRON), loop ceiling and optional authority packet candidates. additive — does not replace schemas/parallel_batch_plan.schema.json.",
  "type": "object",
  "required": ["batch_label", "tracks"],
  "properties": {
    "schema": { "const": "anu_v3.generic_batch_plan.v0" },
    "batch_label": { "type": "string", "minLength": 1 },
    "tracks": {
      "type": "array",
      "minItems": 1,
      "items": { "$ref": "#/definitions/track" }
    }
  },
  "definitions": {
    "track": {
      "type": "object",
      "required": ["task_id"],
      "properties": {
        "track_id": { "type": "string" },
        "task_id": { "type": "string", "minLength": 1 },
        "executor": { "type": "string" },
        "dispatch_cron_id": { "type": "string" },
        "normal_collector_cron_id": { "type": ["string", "null"] },
        "expected_normal_collector_cron_id": { "type": ["string", "null"] },
        "fallback_callback_cron_id": { "type": "string" },
        "expected_files": { "type": "array", "items": { "type": "string" } },
        "expected_artifacts": { "type": "array", "items": { "type": "string" } },
        "forbidden_write_targets": { "type": "array", "items": { "type": "string" } },
        "depends_on": { "type": "array", "items": { "type": "string" } },
        "own_artifacts": { "type": "array", "items": { "type": "string" } },
        "cited_artifacts": { "type": "array", "items": { "type": "string" } },
        "dispatch_status": { "type": "string" },
        "normal_collector_executed": { "type": "boolean" },
        "by_design_no_normal_collector": { "type": "boolean" },
        "result_present": { "type": "boolean" },
        "done_present": { "type": "boolean" },
        "fallback_state": {
          "type": "string",
          "enum": ["PENDING", "FIRED", "CANCELLED", "NONE"]
        },
        "fallback_fire_kst": { "type": ["string", "null"] },
        "terminal_outcome": {
          "type": "string",
          "enum": ["MERGED", "PASS", "DONE", "ACCEPT", "HOLD", "PENDING", "UNKNOWN"]
        },
        "hold_for_chair": { "type": "boolean" },
        "retry_ceiling": { "type": "integer", "minimum": 0 },
        "authority_packets": {
          "type": "array",
          "items": {
            "type": "object",
            "required": ["source"],
            "properties": {
              "source": { "type": "string", "enum": ["normal", "fallback"] },
              "schema": { "type": "string" },
              "ts": { "type": "string" },
              "path": { "type": "string" },
              "status": { "type": "string" }
            }
          }
        }
      },
      "additionalProperties": true
    }
  }
}
