{
  "openapi": "3.1.0",
  "info": {
    "title": "SaaS Grade",
    "version": "1.0.0",
    "description": "Rank workplace chats, work management software, or CRM for one company. Pass category=workplace-chats (default), work-management, or crm. The JSON includes urls.flyer and share.*Flyer so agents can send the comparison poster to a user."
  },
  "paths": {
    "/api/grade": {
      "get": {
        "summary": "Grade a company from query parameters",
        "parameters": [
          { "name": "category", "in": "query", "required": false, "schema": { "enum": ["workplace-chats", "work-management", "crm"] }, "description": "Defaults to workplace-chats" },
          { "name": "size", "in": "query", "required": true, "schema": { "enum": ["2-10", "11-50", "51-200", "201-1000", "1000+"] } },
          { "name": "industry", "in": "query", "required": true, "schema": { "enum": ["software", "hospitality", "retail", "logistics", "construction", "healthcare", "education", "manufacturing"] } },
          { "name": "culture", "in": "query", "required": true, "schema": { "enum": ["slack", "teams", "whatsapp", "imessage", "email", "frontline", "phone-first", "knowledge-work", "microsoft", "engineering", "trello", "jira", "asana", "planner", "spreadsheets", "pipedrive", "hubspot", "outlook", "salesforce", "dynamics"] } },
          { "name": "workKind", "in": "query", "required": false, "schema": { "enum": ["boards", "projects", "delivery", "sites"] }, "description": "Work-management quiz: what the work actually is" },
          { "name": "salesMotion", "in": "query", "required": false, "schema": { "enum": ["list", "inbound", "field", "accounts"] }, "description": "CRM quiz: how the company sells" },
          { "name": "sites", "in": "query", "required": true, "schema": { "enum": ["one", "few", "many"] } },
          { "name": "growth", "in": "query", "required": true, "schema": { "enum": ["onboarding", "offboarding", "ai-workflows", "integrations", "nothing"] } },
          { "name": "cyber", "in": "query", "required": true, "schema": { "enum": ["1", "2", "3", "4", "5", "low", "medium", "high", "strict"] }, "description": "1 = strongly disagree the company must own chats; 5 = strongly agree" },
          { "name": "budget", "in": "query", "required": true, "schema": { "enum": ["tight", "seat", "tool", "platform"] } },
          { "name": "stickiness", "in": "query", "required": true, "schema": { "enum": ["avoid", "wary", "tolerate", "embrace"] } },
          { "name": "ai", "in": "query", "required": true, "schema": { "type": "string" }, "description": "Comma-separated workflows: catchup,handoff,tasks,onboarding,customers,none" },
          { "name": "agents", "in": "query", "required": true, "schema": { "enum": ["none", "assistive", "native", "platform"] } }
        ],
        "responses": {
          "200": { "description": "Grade for this company, including urls.flyer, flyer.plain, try-it-out links, and WhatsApp/Gmail/mailto flyer share links" },
          "400": { "description": "Missing or invalid answers" }
        }
      },
      "post": {
        "summary": "Grade a company from JSON",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "type": "object", "additionalProperties": true }
            }
          }
        },
        "responses": {
          "200": { "description": "Grade for this company, including urls.flyer and flyer share links" },
          "400": { "description": "Missing or invalid answers" }
        }
      }
    }
  }
}
