{
  "openapi": "3.1.0",
  "info": {
    "title": "Daniel Hallman API",
    "summary": "Public health, telemetry, support, and lead intake endpoints for Daniel Hallman.",
    "description": "Field manuals, implementation kits, MCP tools, and step-by-step GoHighLevel troubleshooting playbooks by Daniel Hallman.",
    "version": "1.0.0",
    "contact": {
      "name": "Daniel Hallman",
      "url": "https://danielhallman.com/",
      "email": "daniel@mooshworks.com"
    }
  },
  "servers": [
    {
      "url": "https://danielhallman.com",
      "description": "Production edge worker"
    }
  ],
  "paths": {
    "/health": {
      "get": {
        "summary": "Health check",
        "description": "Returns service health and current ISO timestamp.",
        "operationId": "getHealth",
        "responses": {
          "200": {
            "description": "Service is healthy",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "service": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "timestamp": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "service",
                    "status",
                    "timestamp"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/analytics/summary": {
      "get": {
        "summary": "Telemetry & analytics summary",
        "description": "Returns daily web hits, route breakdown, and social bridge status.",
        "operationId": "getAnalyticsSummary",
        "responses": {
          "200": {
            "description": "Analytics telemetry bucket",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "service": {
                      "type": "string"
                    },
                    "day": {
                      "type": "string"
                    },
                    "web_analytics": {
                      "type": "object"
                    }
                  },
                  "required": [
                    "ok",
                    "service",
                    "day",
                    "web_analytics"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/support-intake": {
      "post": {
        "summary": "Submit support ticket or bug report",
        "description": "Logs support feedback, auto-dispositions bug vs feature requests, and syncs to CRM.",
        "operationId": "createSupportTicket",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email"
                  },
                  "category": {
                    "type": "string",
                    "enum": [
                      "bug",
                      "feature"
                    ]
                  },
                  "message": {
                    "type": "string"
                  },
                  "page_url": {
                    "type": "string"
                  },
                  "thread_id": {
                    "type": "string"
                  }
                },
                "required": [
                  "email",
                  "message"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Support ticket created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "ticket_id": {
                      "type": "string"
                    },
                    "disposition": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "ticket_id",
                    "disposition",
                    "status"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid email or missing message"
          }
        }
      }
    },
    "/optin": {
      "post": {
        "summary": "Capture lead for Blueprint or Launch Kit",
        "description": "Validates email, attaches affiliate tags, and syncs contact to GoHighLevel CRM.",
        "operationId": "submitLeadOptin",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email"
                  },
                  "first": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "source": {
                    "type": "string"
                  },
                  "tags": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "subaccount_domain": {
                    "type": "string"
                  },
                  "plan_tier": {
                    "type": "string"
                  },
                  "operator_track": {
                    "type": "string"
                  }
                },
                "required": [
                  "email"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Contact synced successfully"
          },
          "400": {
            "description": "Invalid email address"
          }
        }
      }
    }
  }
}
