{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/logbrew/json-schema/logbrew-project-setup-state-schema.json",
  "title": "ProjectSetupState",
  "description": "Backend-owned setup state for one project.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/logbrew-projects-api-openapi.yml#/components/schemas/ProjectSetupState",
  "properties": {
    "created_at": {
      "description": "Time the project was created in `LogBrew`.",
      "format": "date-time",
      "type": "string"
    },
    "first_telemetry_seen_at": {
      "description": "First telemetry timestamp, when telemetry has arrived.",
      "format": "date-time",
      "type": [
        "string",
        "null"
      ]
    },
    "last_environment": {
      "description": "Most recent environment observed or selected for the project.",
      "type": [
        "string",
        "null"
      ]
    },
    "last_release": {
      "description": "Most recent release observed for the project.",
      "type": [
        "string",
        "null"
      ]
    },
    "last_seen_at": {
      "description": "Most recent telemetry timestamp, when telemetry has arrived.",
      "format": "date-time",
      "type": [
        "string",
        "null"
      ]
    },
    "last_signal": {
      "anyOf": [
        {
          "$ref": "#/$defs/ProjectLastSignalResponse"
        },
        {
          "type": "null"
        }
      ],
      "description": "Most recent telemetry signal summary, when telemetry has arrived."
    },
    "next": {
      "description": "Display-safe next action.",
      "type": "string"
    },
    "next_action": {
      "$ref": "#/$defs/ProjectSetupNextActionResponse",
      "description": "Stable machine-readable action for clients that should not parse `next`."
    },
    "project_id": {
      "description": "Project identifier.",
      "format": "uuid",
      "type": "string"
    },
    "runtime": {
      "description": "Runtime selected or detected for setup, when known.",
      "type": [
        "string",
        "null"
      ]
    },
    "setup_started_at": {
      "description": "Most recent explicit setup timestamp, when setup has started.",
      "format": "date-time",
      "type": [
        "string",
        "null"
      ]
    },
    "source": {
      "description": "Setup source selected or detected, when known.",
      "type": [
        "string",
        "null"
      ]
    },
    "status": {
      "$ref": "#/$defs/ProjectSetupStatus",
      "description": "Canonical setup status."
    }
  },
  "required": [
    "project_id",
    "status",
    "runtime",
    "source",
    "created_at",
    "setup_started_at",
    "first_telemetry_seen_at",
    "last_seen_at",
    "last_release",
    "last_environment",
    "last_signal",
    "next",
    "next_action"
  ],
  "type": "object",
  "$defs": {
    "ProjectLastSignalResponse": {
      "description": "Most recent telemetry signal summary for setup progress.",
      "properties": {
        "id": {
          "description": "Optional signal identifier.",
          "type": [
            "string",
            "null"
          ]
        },
        "kind": {
          "description": "Telemetry signal kind.",
          "type": "string"
        },
        "message": {
          "description": "Optional display-safe signal message.",
          "type": [
            "string",
            "null"
          ]
        },
        "occurred_at": {
          "description": "Signal occurrence timestamp.",
          "format": "date-time",
          "type": "string"
        }
      },
      "required": [
        "kind",
        "id",
        "message",
        "occurred_at"
      ],
      "type": "object"
    },
    "ProjectSetupNextActionCode": {
      "description": "Stable project setup action codes for clients and agents.",
      "oneOf": [
        {
          "const": "choose_setup_path",
          "description": "Choose a supported SDK, CLI, or API setup path.",
          "type": "string"
        },
        {
          "const": "send_first_telemetry",
          "description": "Send the first telemetry event after setup starts.",
          "type": "string"
        },
        {
          "const": "review_project_dashboard",
          "description": "Review the project dashboard after telemetry is received.",
          "type": "string"
        },
        {
          "const": "upload_release_artifacts",
          "description": "Upload source maps or native debug files for one project.",
          "type": "string"
        }
      ]
    },
    "ProjectSetupNextActionResponse": {
      "description": "Stable machine-readable project setup next action.",
      "properties": {
        "code": {
          "$ref": "#/$defs/ProjectSetupNextActionCode",
          "description": "Stable action code."
        },
        "target": {
          "$ref": "#/$defs/ProjectSetupNextActionTarget",
          "description": "Client surface or route family that should handle the action."
        }
      },
      "required": [
        "code",
        "target"
      ],
      "type": "object"
    },
    "ProjectSetupNextActionTarget": {
      "description": "Stable project setup action targets for clients and agents.",
      "oneOf": [
        {
          "const": "project_setup",
          "description": "Project setup surface.",
          "type": "string"
        },
        {
          "const": "telemetry_ingest",
          "description": "Telemetry ingest surface.",
          "type": "string"
        },
        {
          "const": "project_dashboard",
          "description": "Project dashboard or telemetry review surface.",
          "type": "string"
        },
        {
          "const": "release_artifact_upload",
          "description": "Release artifact upload tooling.",
          "type": "string"
        }
      ]
    },
    "ProjectSetupStatus": {
      "description": "Canonical setup status for project onboarding.",
      "oneOf": [
        {
          "const": "created",
          "description": "Project exists but no setup path has started.",
          "type": "string"
        },
        {
          "const": "setup_started",
          "description": "User selected a setup path or runtime.",
          "type": "string"
        },
        {
          "const": "sdk_seen",
          "description": "SDK or CLI identity was observed without telemetry.",
          "type": "string"
        },
        {
          "const": "first_telemetry_seen",
          "description": "First telemetry was received.",
          "type": "string"
        },
        {
          "const": "active",
          "description": "Project has active telemetry.",
          "type": "string"
        }
      ]
    }
  }
}