{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/yardstick-team/json-schema/yardstick-team-application-status-transition-response-schema.json",
  "title": "ApplicationStatusTransitionResponse",
  "description": "Application status-transition action response. Direct non-terminal transitions may mutate; sensitive or unverified transitions return approval-required or blocked envelopes.",
  "x-generated": "2026-11-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/yardstick-team-openapi.json#/components/schemas/ApplicationStatusTransitionResponse",
  "anyOf": [
    {
      "type": "object",
      "properties": {
        "is_candidate": {
          "type": "boolean",
          "description": "Explicitly admitted to the interview process; Review Applications and Candidates are mutually exclusive per application."
        },
        "candidate_admission_id": {
          "type": [
            "string",
            "null"
          ],
          "format": "uuid",
          "description": "Raw current admission UUID, required as expected_admission_id when undoing."
        },
        "candidate_admitted_at": {
          "type": [
            "string",
            "null"
          ]
        },
        "candidate_admission_origin": {
          "type": [
            "string",
            "null"
          ]
        },
        "candidate_activity_started_at": {
          "type": [
            "string",
            "null"
          ],
          "description": "Non-null after durable candidate activity; undo is then unavailable."
        },
        "id": {
          "type": "string",
          "description": "Display id, e.g. `app_<base32>`"
        },
        "object": {
          "type": "string",
          "enum": [
            "application"
          ]
        },
        "person_id": {
          "type": "string",
          "description": "Canonical `per_...` person id."
        },
        "status": {
          "type": "string"
        },
        "stage": {
          "type": "string",
          "description": "Deprecated free-form stage label. Status transitions never change it; read `pipeline_stage_id` for the pipeline position."
        },
        "pipeline_stage_id": {
          "type": [
            "string",
            "null"
          ],
          "description": "Display id (`pst_<base32>`) of the configured pipeline stage (board column) the application sits in; every status transition moves it to the stage mapped to the new status. Null when no configured stage is assigned."
        },
        "job_id": {
          "type": [
            "string",
            "null"
          ],
          "description": "Canonical `job_...` Job id when the application is linked to a Job; null for legacy or unlinked applications."
        },
        "job_posting_id": {
          "type": [
            "string",
            "null"
          ]
        },
        "source": {
          "type": "object",
          "properties": {
            "token_id": {
              "type": [
                "string",
                "null"
              ]
            },
            "label": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          "required": [
            "token_id",
            "label"
          ],
          "additionalProperties": false
        },
        "livemode": {
          "type": "boolean"
        },
        "created": {
          "type": [
            "string",
            "null"
          ]
        },
        "updated": {
          "type": [
            "string",
            "null"
          ]
        },
        "archived_at": {
          "type": [
            "string",
            "null"
          ],
          "description": "ISO-8601 UTC; non-null when the application has been archived."
        },
        "archived_reason": {
          "type": [
            "string",
            "null"
          ],
          "description": "Free-text archive reason captured at archive time; nullable."
        },
        "transition": {
          "type": "object",
          "properties": {
            "idempotent": {
              "type": "boolean"
            },
            "mutated": {
              "type": "boolean"
            },
            "execution_mode": {
              "type": "string",
              "enum": [
                "direct_write"
              ]
            },
            "pipeline_stage_id": {
              "type": "string",
              "description": "Display id (`pst_<base32>`) of the configured pipeline stage the move resolved to and wrote. Present on a mutating transition (direct write or approval bind). The status is derived from this stage's mapped status, so a request may target the move either by `status` or by `pipeline_stage_id`."
            }
          },
          "required": [
            "idempotent",
            "mutated"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "is_candidate",
        "candidate_admission_id",
        "candidate_admitted_at",
        "candidate_admission_origin",
        "candidate_activity_started_at",
        "id",
        "object",
        "person_id",
        "status",
        "stage",
        "pipeline_stage_id",
        "job_id",
        "job_posting_id",
        "source",
        "livemode",
        "created",
        "updated",
        "archived_at",
        "archived_reason",
        "transition"
      ],
      "additionalProperties": false,
      "description": "Application response returned for idempotent or direct status transitions."
    },
    {
      "type": "object",
      "properties": {
        "object": {
          "type": "string",
          "enum": [
            "application_status_transition"
          ]
        },
        "action": {
          "type": "string",
          "enum": [
            "application.transition_status"
          ]
        },
        "application_id": {
          "type": "string"
        },
        "resource": {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "application"
              ]
            },
            "id": {
              "type": "string"
            }
          },
          "required": [
            "type",
            "id"
          ],
          "additionalProperties": false
        },
        "execution_mode": {
          "type": "string",
          "enum": [
            "direct_write",
            "approval_required",
            "blocked_until_verified"
          ]
        },
        "approval_required": {
          "type": "boolean"
        },
        "blocked": {
          "type": "boolean"
        },
        "action_gate_blocked": {
          "type": "boolean",
          "description": "Present and `true` when an unmet per-stage action gate blocked the move. A distinct discriminator from approval/validity blocks: it is returned (HTTP 409) BEFORE any approval preview, so a gated move never reaches the approval ceremony while the gate is unmet. Pair with `gate` for the machine-readable reason."
        },
        "mutated": {
          "type": "boolean"
        },
        "current_status": {
          "type": "string"
        },
        "proposed_status": {
          "type": "string"
        },
        "proposed_pipeline_stage_id": {
          "type": "string",
          "description": "The pipeline stage (`pst_` id, the board column) the application will move to when the approved transition is bound. Display-only on the approval preview; the legacy `stage` label does not move."
        },
        "reason": {
          "type": [
            "string",
            "null"
          ]
        },
        "gate": {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "description": "The unmet gate type, e.g. `scorecard_submitted`."
            },
            "reason": {
              "type": "string",
              "description": "Human-readable, agent-actionable explanation, e.g. `Needs a submitted scorecard for the current round`."
            }
          },
          "required": [
            "type",
            "reason"
          ],
          "additionalProperties": false,
          "description": "Detail of the unmet action gate, present only alongside `action_gate_blocked: true`."
        },
        "approval": {
          "type": "object",
          "properties": {
            "gate": {
              "type": "string"
            },
            "reason": {
              "type": "string"
            },
            "preview_required": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "binding": {
              "type": "object",
              "properties": {
                "required_fields": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "approved_action_key": {
                  "type": "string",
                  "enum": [
                    "application.transition_status"
                  ]
                },
                "resource_version_precondition": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "required_fields",
                "approved_action_key",
                "resource_version_precondition"
              ],
              "additionalProperties": false
            }
          },
          "required": [
            "gate",
            "reason",
            "preview_required",
            "binding"
          ],
          "additionalProperties": false
        },
        "required_scopes": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "object",
        "action",
        "execution_mode",
        "mutated",
        "current_status",
        "proposed_status"
      ],
      "additionalProperties": false,
      "description": "Application status-transition action envelope returned when a transition requires approval, is blocked by an unmet action gate (`action_gate_blocked`), or is blocked pending verification."
    }
  ]
}