{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/tenpace-com/json-schema/tenpace-com-setup-session-schema.json",
  "title": "SetupSession",
  "x-generated": "2026-10-30",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/tenpace-com-openapi.json#/components/schemas/SetupSession",
  "type": "object",
  "required": [
    "id",
    "status",
    "intent",
    "intentVersion",
    "lockedIntentVersion",
    "intentLocked",
    "setupUrl",
    "plan",
    "connections",
    "result"
  ],
  "properties": {
    "id": {
      "type": "string"
    },
    "status": {
      "type": "string",
      "enum": [
        "awaiting_human",
        "awaiting_github",
        "awaiting_slack",
        "awaiting_slack_workspace",
        "awaiting_slack_channel",
        "ready_to_apply",
        "applying",
        "test_pending",
        "complete",
        "failed",
        "cancelled",
        "expired"
      ]
    },
    "source": {
      "$ref": "#/$defs/SetupSource"
    },
    "intent": {
      "$ref": "#/$defs/SetupIntent"
    },
    "intentVersion": {
      "type": "integer",
      "minimum": 1
    },
    "lockedIntentVersion": {
      "type": [
        "integer",
        "null"
      ]
    },
    "intentLocked": {
      "type": "boolean"
    },
    "approvedIntentVersion": {
      "type": [
        "integer",
        "null"
      ],
      "deprecated": true,
      "description": "Compatibility alias for lockedIntentVersion."
    },
    "approvalValid": {
      "type": "boolean",
      "deprecated": true,
      "description": "Compatibility alias for intentLocked."
    },
    "setupUrl": {
      "type": "string",
      "format": "uri",
      "description": "Human handoff. GitHub Action URLs contain no secret and are actor-bound; other creation sources return a claim capability in the URL fragment only on creation/replay."
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time"
    },
    "expiresAt": {
      "type": "string",
      "format": "date-time"
    },
    "plan": {
      "type": "array",
      "items": {
        "type": "object"
      }
    },
    "humanAction": {
      "type": [
        "object",
        "null"
      ]
    },
    "connections": {
      "type": "object"
    },
    "result": {
      "type": "object"
    },
    "error": {
      "type": [
        "object",
        "null"
      ]
    }
  },
  "$defs": {
    "SetupIntent": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "repository",
        "slackChannel"
      ],
      "properties": {
        "repository": {
          "type": "string",
          "pattern": "^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$"
        },
        "slackChannel": {
          "type": "string",
          "description": "Name with or without a leading #."
        },
        "slackWorkspace": {
          "type": "string",
          "description": "Optional Tenpace workspace ID, Slack team ID, or exact workspace name."
        },
        "preset": {
          "type": "string",
          "enum": [
            "repo_watch",
            "full_coverage",
            "team_activity"
          ],
          "default": "repo_watch"
        },
        "reviewerMentions": {
          "type": "string",
          "enum": [
            "all",
            "connected_only",
            "none"
          ],
          "default": "all"
        }
      }
    },
    "SetupSource": {
      "type": "string",
      "enum": [
        "api",
        "github_action",
        "mcp",
        "cli",
        "review_health_audit"
      ],
      "default": "api"
    }
  }
}