{
  "openapi": "3.0.3",
  "info": {
    "title": "East End Business Services API",
    "description": "Public API for East End Business Services (eebs.us). Versioned by URL path (/api/v1/, /api/v2/, ...). The current version is v1, exposed under /api/v1. The unversioned /api/* paths are deprecated aliases kept working for backward compatibility; every response from a deprecated path carries an RFC 8594 `Deprecation: true` header and a `Link` header with `rel=\"successor-version\"` pointing at its versioned replacement. A `Sunset` header will be added once a removal date for a deprecated path is scheduled — none is scheduled today. See the developer portal at https://eebs.us/developers for a quickstart.\n\nRate limiting: /api, /api/v1, /api/contact, /api/v1/contact (all methods), the homepage, and any 404 are limited to 120 requests per 60-second window per client IP, tracked in a fixed window. Every response on those paths carries `RateLimit-Limit`, `RateLimit-Remaining`, and `RateLimit-Reset` (seconds until the window resets), per the conventions in draft-ietf-httpapi-ratelimit-headers, including error responses. A request over the limit gets `429` plus `Retry-After` (seconds). No authentication is required — the limit is per IP, not per key — and no API key exists to raise it; see /developers.",
    "version": "2.0.0",
    "contact": { "email": "eebs.ny@gmail.com" }
  },
  "servers": [{ "url": "https://www.eebs.us" }],
  "paths": {
    "/api/v1/contact": {
      "post": {
        "summary": "Submit the contact form (v1, canonical)",
        "description": "Submits a contact inquiry from the eebs.us website and forwards it to East End Business Services.",
        "operationId": "submitContactFormV1",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/ContactRequest" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Message accepted and forwarded successfully.",
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimitLimit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimitRemaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimitReset" }
            },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ContactSuccess" }
              }
            }
          },
          "400": {
            "description": "Malformed request body (not valid JSON, or not a JSON object).",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" }
              }
            }
          },
          "405": {
            "description": "Method not allowed. Only POST (and OPTIONS for CORS preflight) is supported.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" }
              }
            }
          },
          "422": {
            "description": "Validation error — a required field is missing or Correo is not a valid email.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" }
              }
            }
          },
          "429": { "$ref": "#/components/responses/RateLimited" },
          "502": {
            "description": "The upstream form-delivery service failed or was unreachable.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" }
              }
            }
          }
        }
      }
    },
    "/api/v1": {
      "get": {
        "summary": "API discovery index (v1, canonical)",
        "description": "Lists current endpoints and the versioning/deprecation policy.",
        "operationId": "getApiIndexV1",
        "responses": {
          "200": {
            "description": "Index of available v1 endpoints.",
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimitLimit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimitRemaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimitReset" }
            },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ApiIndex" }
              }
            }
          },
          "429": { "$ref": "#/components/responses/RateLimited" }
        }
      }
    },
    "/api/contact": {
      "post": {
        "summary": "Submit the contact form (deprecated alias)",
        "description": "Deprecated. Use POST /api/v1/contact instead. Kept working for backward compatibility; responses carry `Deprecation: true` and `Link: <.../api/v1/contact>; rel=\"successor-version\"` headers.",
        "operationId": "submitContactFormLegacy",
        "deprecated": true,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/ContactRequest" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Message accepted and forwarded successfully.",
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimitLimit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimitRemaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimitReset" }
            },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ContactSuccess" }
              }
            }
          },
          "400": {
            "description": "Malformed request body (not valid JSON, or not a JSON object).",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" }
              }
            }
          },
          "405": {
            "description": "Method not allowed. Only POST (and OPTIONS for CORS preflight) is supported.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" }
              }
            }
          },
          "422": {
            "description": "Validation error — a required field is missing or Correo is not a valid email.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" }
              }
            }
          },
          "429": { "$ref": "#/components/responses/RateLimited" },
          "502": {
            "description": "The upstream form-delivery service failed or was unreachable.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" }
              }
            }
          }
        }
      }
    },
    "/api": {
      "get": {
        "summary": "API discovery index (deprecated alias)",
        "description": "Deprecated. Use GET /api/v1 instead.",
        "operationId": "getApiIndexLegacy",
        "deprecated": true,
        "responses": {
          "200": {
            "description": "Index of available endpoints.",
            "headers": {
              "RateLimit-Limit": { "$ref": "#/components/headers/RateLimitLimit" },
              "RateLimit-Remaining": { "$ref": "#/components/headers/RateLimitRemaining" },
              "RateLimit-Reset": { "$ref": "#/components/headers/RateLimitReset" }
            },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ApiIndex" }
              }
            }
          },
          "429": { "$ref": "#/components/responses/RateLimited" }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ContactRequest": {
        "type": "object",
        "required": ["Nombre", "Correo"],
        "properties": {
          "Nombre": {
            "type": "string",
            "description": "Full name of the person contacting EEBS.",
            "example": "Maria Lopez"
          },
          "Correo": {
            "type": "string",
            "format": "email",
            "description": "Reply-to email address.",
            "example": "maria@example.com"
          },
          "Teléfono": {
            "type": "string",
            "description": "Optional phone number.",
            "example": "(631) 000-0000"
          },
          "Servicio": {
            "type": "string",
            "description": "Service the inquiry is about.",
            "enum": [
              "Takeoffs de Construcción",
              "Nómina / Payroll",
              "Organización Financiera",
              "Todos los servicios",
              "Tengo una pregunta general"
            ]
          },
          "Mensaje": {
            "type": "string",
            "description": "Optional free-text message.",
            "example": "Necesito un estimado para un proyecto de framing."
          }
        }
      },
      "ContactSuccess": {
        "type": "object",
        "properties": {
          "success": { "type": "boolean", "example": true },
          "message": {
            "type": "string",
            "example": "Mensaje enviado. Te responderemos en menos de 24 horas."
          }
        }
      },
      "ApiIndex": {
        "type": "object",
        "properties": {
          "name": { "type": "string" },
          "version": { "type": "string", "example": "v1" },
          "openapi": { "type": "string", "format": "uri" },
          "developer_portal": { "type": "string", "format": "uri" },
          "versioning_policy": {
            "type": "object",
            "properties": {
              "scheme": { "type": "string" },
              "deprecation": { "type": "string" }
            }
          },
          "endpoints": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "path": { "type": "string" },
                "method": { "type": "string" },
                "description": { "type": "string" }
              }
            }
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "required": ["code", "message"],
            "properties": {
              "code": {
                "type": "string",
                "description": "Stable machine-readable error identifier.",
                "example": "VALIDATION_ERROR"
              },
              "message": {
                "type": "string",
                "description": "Human-readable explanation of what went wrong.",
                "example": "Missing required field(s): Correo."
              },
              "resolution": {
                "type": "string",
                "description": "How to fix the request.",
                "example": "Include Nombre and Correo in the request body."
              }
            }
          }
        }
      }
    },
    "headers": {
      "RateLimitLimit": {
        "description": "The request quota for the current 60-second window, per client IP.",
        "schema": { "type": "integer", "example": 120 }
      },
      "RateLimitRemaining": {
        "description": "Requests remaining in the current window for this client IP.",
        "schema": { "type": "integer", "example": 119 }
      },
      "RateLimitReset": {
        "description": "Seconds until the current window resets and the quota refills.",
        "schema": { "type": "integer", "example": 42 }
      }
    },
    "responses": {
      "RateLimited": {
        "description": "Rate limit exceeded for this client IP on this path.",
        "headers": {
          "Retry-After": {
            "description": "Seconds to wait before retrying — always equal to RateLimit-Reset.",
            "schema": { "type": "integer" }
          },
          "RateLimit-Limit": { "$ref": "#/components/headers/RateLimitLimit" },
          "RateLimit-Remaining": {
            "description": "Always 0 on a 429.",
            "schema": { "type": "integer", "example": 0 }
          },
          "RateLimit-Reset": { "$ref": "#/components/headers/RateLimitReset" }
        },
        "content": {
          "application/json": {
            "schema": { "$ref": "#/components/schemas/ErrorResponse" },
            "example": {
              "error": {
                "code": "RATE_LIMITED",
                "message": "Rate limit exceeded for /api/v1/contact.",
                "resolution": "This IP has exceeded the request limit for this window. Wait for Retry-After seconds, then retry. See /developers for the documented limit."
              }
            }
          }
        }
      }
    }
  }
}
