{
  "openapi": "3.1.0",
  "info": {
    "title": "Abdulkerim Sesli Portfolio API",
    "description": "Public API endpoints for portfolio website",
    "version": "1.0.0",
    "contact": {
      "name": "Abdulkerim Sesli",
      "email": "kontakt@abdulkerimsesli.de",
      "url": "https://www.abdulkerimsesli.de"
    },
    "license": {
      "name": "MIT",
      "url": "https://github.com/aKs030/iweb/blob/main/LICENSE"
    }
  },
  "servers": [
    {
      "url": "https://www.abdulkerimsesli.de",
      "description": "Production server"
    }
  ],
  "paths": {
    "/api/search": {
      "post": {
        "summary": "AI-powered search",
        "description": "Search website content using Cloudflare AI Search with RAG",
        "operationId": "searchContent",
        "tags": ["Search"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["query"],
                "properties": {
                  "query": {
                    "type": "string",
                    "description": "Search query",
                    "example": "Three.js projects"
                  },
                  "limit": {
                    "type": "integer",
                    "description": "Maximum results",
                    "default": 10,
                    "minimum": 1,
                    "maximum": 50
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Search results",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["results", "total"],
                  "properties": {
                    "results": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": ["title", "url", "snippet", "score"],
                        "properties": {
                          "title": { "type": "string" },
                          "url": { "type": "string" },
                          "snippet": { "type": "string" },
                          "score": { "type": "number" }
                        }
                      }
                    },
                    "total": { "type": "integer" }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/ai": {
      "post": {
        "summary": "AI chat completion",
        "description": "Chat with AI robot companion using Groq API",
        "operationId": "chatCompletion",
        "tags": ["AI"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["message"],
                "properties": {
                  "message": {
                    "type": "string",
                    "description": "User message",
                    "example": "Tell me about your projects"
                  },
                  "context": {
                    "type": "string",
                    "description": "Current page context",
                    "example": "home"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "AI response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["response", "model"],
                  "properties": {
                    "response": { "type": "string" },
                    "model": { "type": "string" }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/contact": {
      "post": {
        "summary": "Contact form submission",
        "description": "Send contact message via email",
        "operationId": "sendContact",
        "tags": ["Contact"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["name", "email", "message"],
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Sender name",
                    "example": "John Doe"
                  },
                  "email": {
                    "type": "string",
                    "format": "email",
                    "description": "Sender email",
                    "example": "john@example.com"
                  },
                  "message": {
                    "type": "string",
                    "description": "Message content",
                    "example": "I'd like to discuss a project"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Message sent successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["success", "message"],
                  "properties": {
                    "success": { "type": "boolean" },
                    "message": { "type": "string" }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "tags": [
    {
      "name": "Search",
      "description": "AI-powered search endpoints"
    },
    {
      "name": "AI",
      "description": "AI chat and completion endpoints"
    },
    {
      "name": "Contact",
      "description": "Contact form endpoints"
    }
  ]
}
