{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://workspace.local/schemas/anu_normal_callback_envelope_v1.json",
  "title": "ANU Normal Callback Envelope v1 (task-2694+1)",
  "description": "JSON Schema for ANU normal callback registration envelope. 회장 verbatim ANCHOR-2 (2026-05-27): task-2693 envelope에서 schedule_type=to_be_registered_by_finish_task_sh 어구로 deferred 우회가 발생함. 본 schema는 schedule_type enum을 통해 deferred / pending / to_be_registered_by_finish_task_sh 어구를 정적 단계에서 reject하여 사고 재발을 차단한다. ANU normal callback 4-source 검증(inbound / collector / cron_dispatch / cron_fallback) 결속을 위한 envelope 표준 정의.",
  "type": "object",
  "required": [
    "schema",
    "task_id",
    "schedule_id",
    "schedule_type",
    "owner_key",
    "chat_id",
    "chair_facing_sid",
    "emitted_at"
  ],
  "properties": {
    "schema": {
      "type": "string",
      "const": "schemas.anu_normal_callback_envelope_v1",
      "description": "Schema identifier. 본 envelope을 식별하는 고정 상수."
    },
    "task_id": {
      "type": "string",
      "pattern": "^task-[0-9]+(\\.[0-9]+|_[0-9]+\\.[0-9]+|\\+[0-9a-z]+)?$",
      "description": "Task identifier. task-NNN, task-NNN.M, task-NNN_M.K, task-NNN+suffix 형식 허용."
    },
    "schedule_id": {
      "type": "string",
      "minLength": 1,
      "description": "Schedule unique identifier. placeholder 차단은 validator 단에서 다층 검증 (TBD/PLACEHOLDER/null/empty 등)."
    },
    "schedule_type": {
      "type": "string",
      "description": "callback registration의 schedule type. ★ 회장 verbatim 차단 어구 (deferred / pending / to_be_registered_by_finish_task_sh) 는 enum에서 명시 제외 → schema validation 단계에서 즉시 reject. task-2693 사고 박제 (envelope에 schedule_type=to_be_registered_by_finish_task_sh 어구로 deferred 우회 발생).",
      "enum": [
        "cron_once",
        "cron_recurring",
        "absolute_one_time"
      ]
    },
    "owner_key": {
      "type": "string",
      "pattern": "^[0-9a-f]{16}$",
      "description": "Owner identifier (ANU/dev key 표준: 16-char lowercase hex)."
    },
    "chat_id": {
      "type": "string",
      "minLength": 1,
      "description": "Chat identifier (numeric string 권장)."
    },
    "chair_facing_sid": {
      "type": "string",
      "minLength": 1,
      "description": "Chair-facing session identifier. 회장 verbatim ANU normal callback 4-source 검증 강제 — inbound / collector / cron_dispatch / cron_fallback 3 SID 모두 동일 (53e89540-...) 일관성 요구."
    },
    "emitted_at": {
      "type": "string",
      "format": "date-time",
      "description": "Envelope emission timestamp (ISO 8601, UTC 권장)."
    },
    "inbound_evidence": {
      "type": "string",
      "description": "Inbound evidence file path (optional, NON_AUTHORITATIVE 검증 보조)."
    },
    "collector_receipt": {
      "type": "string",
      "description": "Collector receipt file path (optional, 4-source 검증 보조)."
    },
    "envelope_sha256": {
      "type": "string",
      "pattern": "^[0-9a-f]{64}$",
      "description": "Envelope content SHA256 hash (optional, recommended for tamper detection)."
    },
    "executor_key": {
      "type": "string",
      "description": "Executor identifier (optional, NON_AUTHORITATIVE 검증용 — owner_key와 별도 트레이스)."
    },
    "cron_id_dispatch": {
      "type": "string",
      "description": "Cron ID for dispatch path (optional, 4-tuple 결속)."
    },
    "cron_id_normal_collector": {
      "type": "string",
      "description": "Cron ID for normal collector path (optional, 4-tuple 결속)."
    },
    "cron_id_fallback_callback": {
      "type": "string",
      "description": "Cron ID for fallback callback path (optional, 4-tuple 결속)."
    },
    "chair_facing_session_id": {
      "type": "string",
      "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",
      "description": "task-2686 session propagation (필드 1/3). chair_facing_sid 의 long-form alias (동일 값 — 명명 정합). cokacdir --session 에 전달."
    },
    "collector_session_id": {
      "type": "string",
      "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",
      "description": "session propagation (필드 2/3). callback 처리 ANU collector 세션 SID. chair_facing 과 불일치 시 AUTHORITATIVE_BUT_SESSION_DISCONTINUITY."
    },
    "delivery_session_id": {
      "type": "string",
      "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",
      "description": "session propagation (필드 3/3). 회장 전달 세션 SID."
    },
    "callback_resume_required": {
      "type": "boolean",
      "description": "true 면 cokacdir --session 강제 (task-2686 dispatch prompt inline doctrine)."
    },
    "collector_role": {
      "type": "string",
      "enum": ["ANU"],
      "description": "회장 §10 collector role 단일 enum (PR #152 envelope 필드, optional)."
    }
  },
  "additionalProperties": true
}
