"/fusion/whoami":
    get:
        tags: [Fusion]
        operationId: fusionWhoami
        summary: Fusion auth probe
        description: |
            Returns the fusion-api auth status — used by Fusion 360 workstations to confirm
            their `fusion-api` bearer is valid before pulling a toolpath job.
        security:
            - fusionApiKey: []
        responses:
            "200":
                description: Caller's fusion auth status.
                content:
                    application/json:
                        schema:
                            type: object
                            properties:
                                authorizedApp: { type: string, description: Application id authenticated for the request. }
                                authenticated: { type: boolean }
            "401": { $ref: "../admin-api.yaml#/components/responses/Unauthorized" }

"/fusion/next":
    get:
        tags: [Fusion]
        operationId: fusionNext
        summary: Pull the next toolpath generation job
        description: |
            Returns the next manufacturing job that is ready for Fusion-360-side toolpath
            generation, including a compressed copy of the scan to consume. The job is
            advanced to the relevant in-progress state as part of this call.
        security:
            - fusionApiKey: []
        responses:
            "200":
                description: Next job to process, with its compressed scan.
                content:
                    application/json:
                        schema:
                            type: object
                            properties:
                                jobId: { type: string }
                                toolPathId: { type: string }
                                ipd: { type: integer }
                                meshData:
                                    type: string
                                    description: Deflate-compressed, base64-encoded mesh.
            "401": { $ref: "../admin-api.yaml#/components/responses/Unauthorized" }

"/fusion/{toolPathId}":
    parameters:
        - in: path
          name: toolPathId
          required: true
          schema: { type: string }
          description: The toolpath id returned by `/fusion/next`.
    put:
        tags: [Fusion]
        operationId: fusionUploadToolPath
        summary: Upload a completed toolpath file
        description: |
            Uploads the finished toolpath file produced by Fusion 360 for the given job.
            The request body is the raw file (`multipart/form-data`); the handler is wrapped
            in `toolPathUploadHandler`.
        security:
            - fusionApiKey: []
        requestBody:
            required: true
            content:
                multipart/form-data:
                    schema:
                        type: object
                        properties:
                            file:
                                type: string
                                format: binary
                                description: The toolpath file produced by Fusion 360.
        responses:
            "200":
                description: Toolpath stored.
            "401": { $ref: "../admin-api.yaml#/components/responses/Unauthorized" }
