{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/yardstick-team/json-schema/yardstick-team-staged-builder-action-response-schema.json",
  "title": "StagedBuilderActionResponse",
  "description": "Staged interview-plan builder checkpoint response, shared by the generation stages and the verbatim edit actions. `data` echoes the stored stage content (including prune reports on cascading deletes) and `checkpoint.stage_versions` carries the per-stage versions used for `source_stage` preconditions.",
  "x-generated": "2026-11-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/yardstick-team-openapi.json#/components/schemas/StagedBuilderActionResponse",
  "type": "object",
  "properties": {
    "resource": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "interview_plan_draft",
            "interview_plan"
          ]
        },
        "id": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "type",
        "id"
      ],
      "additionalProperties": false
    },
    "action": {
      "type": "string",
      "enum": [
        "interview_plan.generate_outcomes",
        "interview_plan.confirm_outcomes",
        "interview_plan.generate_competencies",
        "interview_plan.generate_skills",
        "interview_plan.generate_rounds",
        "interview_plan.add_rounds",
        "interview_plan.update_rounds",
        "interview_plan.delete_rounds",
        "interview_plan.generate_anchors",
        "interview_plan.generate_questions_directions",
        "interview_plan.add_competencies",
        "interview_plan.update_competencies",
        "interview_plan.delete_competencies",
        "interview_plan.add_skills",
        "interview_plan.update_skills",
        "interview_plan.delete_skills",
        "interview_plan.clear_outcomes",
        "interview_plan.clear_competencies",
        "interview_plan.clear_job_skills",
        "interview_plan.clear_interview_sequence",
        "interview_plan.validate_draft",
        "interview_plan.publish",
        "interview_plan.modify_active",
        "interview_plan.add_questions",
        "interview_plan.update_questions",
        "interview_plan.delete_questions",
        "interview_plan.update_round_directions",
        "interview_plan.update_anchors",
        "interview_plan.delete_anchors"
      ]
    },
    "execution_mode": {
      "type": "string",
      "enum": [
        "draft_write",
        "interactive_gate",
        "validate_only",
        "approval_required",
        "blocked_until_verified"
      ]
    },
    "approval": {
      "type": "object",
      "properties": {
        "gate": {
          "type": "string",
          "enum": [
            "none",
            "agent_confirmable",
            "dashboard_required"
          ]
        },
        "required": {
          "type": "boolean"
        },
        "reason": {
          "type": "string"
        }
      },
      "required": [
        "gate",
        "required",
        "reason"
      ],
      "additionalProperties": false
    },
    "stage": {
      "type": "string"
    },
    "data": {
      "type": "object",
      "properties": {
        "status": {
          "type": "string",
          "enum": [
            "checkpointed",
            "generated",
            "generation_pending",
            "validated",
            "not_ready",
            "unsupported_stage",
            "approval_required",
            "blocked"
          ]
        },
        "message": {
          "type": "string"
        },
        "outcomes": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": {}
          }
        },
        "competencies": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": {}
          }
        },
        "job_skills": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": {}
          }
        },
        "interview_sequence": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": {}
          }
        },
        "questions_and_directions": {
          "type": "object",
          "additionalProperties": {}
        },
        "behavioral_anchors": {
          "type": "object",
          "additionalProperties": {}
        },
        "round_id": {
          "type": "string"
        },
        "questions": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": {}
          }
        },
        "interviewer_directions": {
          "type": [
            "string",
            "null"
          ]
        },
        "candidate_directions": {
          "type": [
            "string",
            "null"
          ]
        },
        "pruned_behavioral_anchor_ids": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Item ids whose behavioral anchors were pruned because their competency was deleted in this request."
        },
        "pruned_question_round_ids": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Round ids whose questions and directions were pruned because the round was deleted in this request."
        },
        "generated_round_ids": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "generated_competency_ids": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "preview": {
          "type": "object",
          "additionalProperties": {}
        },
        "affected_counts": {
          "type": "object",
          "additionalProperties": {}
        },
        "audit": {
          "type": "object",
          "properties": {
            "audit_id": {
              "type": "string"
            },
            "event_id": {
              "type": "string"
            },
            "audit_log": {
              "type": "string"
            },
            "api_event": {
              "type": "string"
            }
          },
          "required": [
            "audit_log",
            "api_event"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "status",
        "message"
      ],
      "additionalProperties": false
    },
    "checkpoint": {
      "type": "object",
      "properties": {
        "stage": {
          "type": "string"
        },
        "version": {
          "type": "integer",
          "minimum": 0
        },
        "stage_versions": {
          "type": "object",
          "additionalProperties": {}
        }
      },
      "required": [
        "stage",
        "version",
        "stage_versions"
      ],
      "additionalProperties": false
    },
    "validation": {
      "type": "object",
      "properties": {
        "status": {
          "type": "string",
          "enum": [
            "not_evaluated",
            "ready",
            "blocked"
          ]
        },
        "publish_ready": {
          "type": "boolean"
        },
        "blockers": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "path": {
                "type": "string"
              },
              "next_action": {
                "type": "string"
              }
            },
            "required": [
              "code",
              "message"
            ],
            "additionalProperties": false
          }
        },
        "warnings": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "path": {
                "type": "string"
              },
              "next_action": {
                "type": "string"
              }
            },
            "required": [
              "code",
              "message"
            ],
            "additionalProperties": false
          }
        }
      },
      "required": [
        "status",
        "publish_ready",
        "blockers",
        "warnings"
      ],
      "additionalProperties": false
    },
    "next_actions": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "interview_plan.generate_outcomes",
          "interview_plan.confirm_outcomes",
          "interview_plan.generate_competencies",
          "interview_plan.generate_skills",
          "interview_plan.generate_rounds",
          "interview_plan.add_rounds",
          "interview_plan.update_rounds",
          "interview_plan.delete_rounds",
          "interview_plan.generate_anchors",
          "interview_plan.generate_questions_directions",
          "interview_plan.add_competencies",
          "interview_plan.update_competencies",
          "interview_plan.delete_competencies",
          "interview_plan.add_skills",
          "interview_plan.update_skills",
          "interview_plan.delete_skills",
          "interview_plan.clear_outcomes",
          "interview_plan.clear_competencies",
          "interview_plan.clear_job_skills",
          "interview_plan.clear_interview_sequence",
          "interview_plan.validate_draft",
          "interview_plan.publish",
          "interview_plan.modify_active",
          "interview_plan.add_questions",
          "interview_plan.update_questions",
          "interview_plan.delete_questions",
          "interview_plan.update_round_directions",
          "interview_plan.update_anchors",
          "interview_plan.delete_anchors"
        ]
      }
    },
    "web_url": {
      "type": [
        "string",
        "null"
      ]
    },
    "request_id": {
      "type": "string"
    },
    "warnings": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "description": "Machine-readable warning code (e.g. department_mismatch)."
          },
          "message": {
            "type": "string"
          },
          "detail": {
            "type": "object",
            "additionalProperties": {}
          }
        },
        "required": [
          "code",
          "message"
        ],
        "additionalProperties": false
      },
      "description": "Non-blocking signals emitted by this action (e.g., department_mismatch when source_job_id seeding produced a Department override). Omitted when empty."
    }
  },
  "required": [
    "resource",
    "action",
    "execution_mode",
    "approval",
    "stage",
    "data",
    "validation",
    "next_actions",
    "web_url",
    "request_id"
  ],
  "additionalProperties": false
}