{
  "openapi": "3.1.0",
  "info": {
    "title": "aicuban demo",
    "description": "Medical coding workflow demo. Sample workflows and illustrative codes only, not for real billing. Public, keyless, CORS-enabled (`Access-Control-Allow-Origin: *`, no credentials). Saga Dog Corp \u00b7 Research-driven AI from Miami.",
    "version": "0.2.0"
  },
  "servers": [
    {
      "url": "https://aicuban.vercel.app"
    }
  ],
  "paths": {
    "/api/health": {
      "get": {
        "summary": "Health",
        "operationId": "health_api_health_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "ai": {
                      "type": "string",
                      "description": "AI provider in use, or template"
                    }
                  },
                  "type": "object",
                  "required": [
                    "ok",
                    "ai"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/workflows": {
      "get": {
        "summary": "Workflows",
        "operationId": "workflows_api_workflows_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "title": {
                        "type": "string"
                      },
                      "summary": {
                        "type": "string"
                      },
                      "definition": {
                        "type": "object",
                        "description": "Workflow definition: title, summary, start, nodes[]"
                      }
                    },
                    "type": "object",
                    "required": [
                      "id",
                      "title",
                      "summary",
                      "definition"
                    ]
                  },
                  "type": "array"
                }
              }
            }
          }
        }
      }
    },
    "/api/run": {
      "post": {
        "summary": "Run Workflow",
        "operationId": "run_workflow_api_run_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RunRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "path": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "answers": {
                      "items": {
                        "properties": {
                          "question": {
                            "type": "string"
                          },
                          "answer": {
                            "type": "string"
                          },
                          "next": {
                            "type": "string"
                          }
                        },
                        "type": "object",
                        "required": [
                          "question",
                          "answer",
                          "next"
                        ]
                      },
                      "type": "array"
                    },
                    "procedures": {
                      "items": {
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "description": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "suggested_codes": {
                            "items": {
                              "type": "string"
                            },
                            "type": "array"
                          }
                        },
                        "type": "object",
                        "required": [
                          "id",
                          "name",
                          "description",
                          "suggested_codes"
                        ]
                      },
                      "type": "array"
                    },
                    "summary": {
                      "properties": {
                        "mode": {
                          "type": "string",
                          "description": "template, or the AI provider used"
                        },
                        "text": {
                          "type": "string"
                        }
                      },
                      "type": "object",
                      "required": [
                        "mode",
                        "text"
                      ],
                      "description": "Present when explain=true."
                    }
                  },
                  "type": "object",
                  "required": [
                    "path",
                    "answers",
                    "procedures"
                  ]
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
          }
        },
        "type": "object",
        "title": "HTTPValidationError"
      },
      "RunRequest": {
        "properties": {
          "workflow_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Workflow Id"
          },
          "workflow": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Workflow"
          },
          "answers": {
            "additionalProperties": {
              "type": "string"
            },
            "type": "object",
            "title": "Answers",
            "default": {}
          },
          "explain": {
            "type": "boolean",
            "title": "Explain",
            "default": true
          }
        },
        "type": "object",
        "title": "RunRequest"
      },
      "ValidationError": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          },
          "input": {
            "title": "Input"
          },
          "ctx": {
            "type": "object",
            "title": "Context"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      }
    }
  }
}