{
  "openapi": "3.1.0",
  "info": {
    "title": "Mete Güneş Public API & Agent Services",
    "version": "1.0.0",
    "description": "Public API providing deterministic website SEO/GEO/AEO site audits, automation ROI calculations, and AI agent integration services by Mete Güneş.",
    "contact": {
      "name": "Mete Güneş",
      "url": "https://metegunes.io/developers",
      "email": "contact@metegunes.io"
    },
    "license": {
      "name": "MIT",
      "url": "https://opensource.org/licenses/MIT"
    }
  },
  "servers": [
    {
      "url": "https://metegunes.io",
      "description": "Production Server"
    }
  ],
  "paths": {
    "/api/site-audit": {
      "get": {
        "summary": "Deterministic SEO, GEO, and AEO website audit",
        "description": "Evaluates a target public website URL against technical SEO, Generative Engine Optimization (GEO), and Answer Engine Optimization (AEO) deterministic rules.",
        "operationId": "runSiteAudit",
        "parameters": [
          {
            "name": "url",
            "in": "query",
            "required": true,
            "description": "The public HTTP or HTTPS URL to audit.",
            "schema": {
              "type": "string",
              "format": "uri",
              "example": "https://example.com"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Audit completed successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SiteAuditResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid or missing URL parameter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Target URL unprocessable or unreachable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (10 requests per 10-minute window)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/roi-calc": {
      "get": {
        "summary": "Automation ROI and hours saved calculation",
        "description": "Calculates projected annual financial savings, break-even period, and operational efficiency gains from automating business workflows.",
        "operationId": "calculateRoi",
        "parameters": [
          {
            "name": "monthlyExecutions",
            "in": "query",
            "required": true,
            "description": "Number of monthly task runs or transactions.",
            "schema": {
              "type": "number",
              "default": 250000,
              "example": 250000
            }
          },
          {
            "name": "developerHourlyRate",
            "in": "query",
            "required": false,
            "description": "Hourly cost in USD for engineering or manual operations.",
            "schema": {
              "type": "number",
              "default": 65,
              "example": 65
            }
          },
          {
            "name": "serverHostingCost",
            "in": "query",
            "required": false,
            "description": "Estimated monthly hosting and cloud infrastructure cost in USD.",
            "schema": {
              "type": "number",
              "default": 40,
              "example": 40
            }
          },
          {
            "name": "dataComplexity",
            "in": "query",
            "required": false,
            "description": "Complexity tier: 1 (basic), 2 (intermediate), 3 (advanced multi-system).",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 3,
              "default": 2,
              "example": 2
            }
          }
        ],
        "responses": {
          "200": {
            "description": "ROI calculation completed successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoiCalculationResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters supplied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ErrorResponse": {
        "type": "object",
        "required": ["error"],
        "properties": {
          "error": {
            "type": "string",
            "description": "Error description message."
          },
          "code": {
            "type": "string",
            "description": "Machine-readable error identifier."
          },
          "status": {
            "type": "integer",
            "description": "HTTP status code."
          }
        }
      },
      "SiteAuditResponse": {
        "type": "object",
        "required": ["schema_version", "audited_at", "url", "scores", "facts", "checks"],
        "properties": {
          "schema_version": {
            "type": "string",
            "example": "metegunes_public_audit/v1"
          },
          "audited_at": {
            "type": "string",
            "format": "date-time"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "scores": {
            "type": "object",
            "required": ["seo", "geo", "aeo"],
            "properties": {
              "seo": { "type": "integer", "minimum": 0, "maximum": 100 },
              "geo": { "type": "integer", "minimum": 0, "maximum": 100 },
              "aeo": { "type": "integer", "minimum": 0, "maximum": 100 }
            }
          },
          "facts": {
            "type": "object",
            "properties": {
              "title": { "type": "string" },
              "description": { "type": "string" },
              "canonical": { "type": "string" },
              "h1Count": { "type": "integer" },
              "h2Count": { "type": "integer" },
              "jsonLdCount": { "type": "integer" },
              "wordCount": { "type": "integer" }
            }
          },
          "checks": {
            "type": "array",
            "items": {
              "type": "object",
              "required": ["id", "label", "status", "detail", "weight"],
              "properties": {
                "id": { "type": "string" },
                "label": { "type": "string" },
                "status": { "type": "string", "enum": ["pass", "warn", "fail"] },
                "detail": { "type": "string" },
                "weight": { "type": "number" }
              }
            }
          },
          "limits": {
            "type": "array",
            "items": { "type": "string" }
          }
        }
      },
      "RoiCalculationResponse": {
        "type": "object",
        "required": ["schema_version", "calculated_at", "inputs", "results", "currency"],
        "properties": {
          "schema_version": { "type": "string" },
          "calculated_at": { "type": "string", "format": "date-time" },
          "inputs": {
            "type": "object",
            "properties": {
              "monthlyExecutions": { "type": "number" },
              "developerHourlyRate": { "type": "number" },
              "serverHostingCost": { "type": "number" },
              "dataComplexity": { "type": "integer" }
            }
          },
          "results": {
            "type": "object",
            "properties": {
              "makeMonthlyCost": { "type": "number" },
              "customMonthlyCost": { "type": "number" },
              "monthlySavings": { "type": "number" },
              "annualSavings": { "type": "number" },
              "oneTimeSetupCost": { "type": "number" },
              "paybackPeriodMonths": { "type": "number" },
              "roiPercentage": { "type": "number" }
            }
          },
          "currency": { "type": "string", "example": "USD" }
        }
      }
    }
  }
}
