{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "schemas/callback_4tuple_writeback.schema.json",
  "title": "anu_v3.callback_4tuple_writeback.v1",
  "description": "task-2553+47 §3/§4.1 — outcome of the 정정 표준 (a) normal-callback collector's one-shot durable-success write-back into callback_4tuple_index. A correctly-bound state=COMPLETED record (normal_collector_cron_id / fallback_cron_id / task_id / dispatch_id / chat_id / role) is appended via the +44 registry's existing append-only API (the +44 module stays byte-0; the registry is NOT escalated to a merge/dispatch executor, §6). Append-only & idempotent: a repeated write-back with an identical normal-collector binding is WRITEBACK_IDEMPOTENT_SKIP (no duplicate line, §8.6). normal_collector_cron_id missing -> CALLBACK_MANDATORY_VIOLATION with NO append (callback mandatory rule preserved, §8.10).",
  "type": "object",
  "required": [
    "schema",
    "status",
    "task_id",
    "appended",
    "record",
    "reasons"
  ],
  "properties": {
    "schema": {
      "type": "string",
      "const": "anu_v3.callback_4tuple_writeback.v1"
    },
    "status": {
      "type": "string",
      "enum": [
        "WRITEBACK_COMPLETED",
        "WRITEBACK_IDEMPOTENT_SKIP",
        "CALLBACK_MANDATORY_VIOLATION"
      ]
    },
    "task_id": { "type": "string", "minLength": 1 },
    "appended": {
      "type": "boolean",
      "description": "True only on WRITEBACK_COMPLETED (exactly one append-only COMPLETED line). False on idempotent skip and on mandatory-violation refusal."
    },
    "record": {
      "description": "The appended COMPLETED ledger record (callback_4tuple_ledger_record.v1) on WRITEBACK_COMPLETED, else null.",
      "oneOf": [
        { "type": "null" },
        {
          "type": "object",
          "required": [
            "schema",
            "task_id",
            "dispatch_id",
            "dispatch_cron_id",
            "executor",
            "chat_id",
            "normal_collector_cron_id",
            "fallback_callback_cron_id",
            "role",
            "status"
          ],
          "properties": {
            "schema": { "type": "string" },
            "task_id": { "type": "string", "minLength": 1 },
            "dispatch_id": { "type": "string" },
            "dispatch_cron_id": { "type": "string" },
            "executor": { "type": "string" },
            "chat_id": { "type": "string" },
            "normal_collector_cron_id": {
              "type": "string",
              "minLength": 1,
              "description": "MANDATORY executor normal-completion lifecycle signal. Must be a non-empty cron id on a COMPLETED write-back (§8.10)."
            },
            "fallback_callback_cron_id": {
              "type": ["string", "null"],
              "description": "Bound fallback cron id, or null with an explicit no_fallback contract. A null/absent fallback is never a cancel target (§8.7)."
            },
            "role": { "type": "string" },
            "status": { "type": "string", "const": "COMPLETED" },
            "no_fallback": { "type": "boolean" },
            "ts_kst": { "type": "string" }
          },
          "additionalProperties": true
        }
      ]
    },
    "reasons": {
      "type": "array",
      "items": { "type": "string" }
    }
  },
  "additionalProperties": false
}
