{
  "openapi": "3.1.0",
  "info": {
    "title": "Dellano Sanz Studio API & Agent Protocols",
    "version": "1.0.0",
    "description": "Public REST API, Streamable HTTP MCP server, and NLWeb v0.55 query interface for Dellano Sanz Fotografia e Filmes (Marilândia, ES, Brazil) and AI software ecosystem.",
    "contact": {
      "name": "Dellano Sanz",
      "url": "https://dellanosanz.com.br/developers",
      "email": "contato@dellanosanz.com.br"
    }
  },
  "servers": [
    {
      "url": "https://dellanosanz.com.br",
      "description": "Production server"
    }
  ],
  "paths": {
    "/api/packages": {
      "get": {
        "operationId": "listStudioPackages",
        "summary": "List studio photography packages in BRL",
        "description": "Returns the official photography studio and event packages offered by Dellano Sanz in Marilândia-ES and Espírito Santo, priced in Brazilian Reais (BRL), with optional category filtering.",
        "parameters": [
          {
            "name": "category",
            "in": "query",
            "required": false,
            "description": "Optional package category filter (e.g., studio, maternity, corporate, wedding, event).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Studio package list returned successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PackageListResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid category filter parameter.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StructuredErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/quotes": {
      "post": {
        "operationId": "createQuoteRequest",
        "summary": "Create a structured studio quote request",
        "description": "Validates client name, requested service, and target date (YYYY-MM-DD), matches the corresponding BRL package estimate when available, and returns a structured quote summary ready for confirmation.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QuoteRequestInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Structured quote summary generated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QuoteResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation error in one or more input fields.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StructuredErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/contact": {
      "post": {
        "operationId": "submitContactMessage",
        "summary": "Submit a contact or quote inquiry message",
        "description": "Submits a contact inquiry to Dellano Sanz studio. Requires valid name (>=2 chars), email, message (>=10 chars), and startedAt timestamp (elapsed >= 1500ms) for non-tracking anti-spam protection.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ContactRequestInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Contact message delivered to configured upstream endpoint.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContactSuccessResponse"
                }
              }
            }
          },
          "202": {
            "description": "Contact payload validated; upstream contact endpoint is not configured in this environment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContactSuccessResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid contact form input.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContactErrorResponse"
                }
              }
            }
          },
          "502": {
            "description": "Upstream contact relay failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContactErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/mcp": {
      "post": {
        "operationId": "invokeMcpServer",
        "summary": "Invoke Dellano Sanz Streamable HTTP MCP Server",
        "description": "Model Context Protocol (MCP) Streamable HTTP JSON-RPC 2.0 endpoint (protocolVersion 2025-03-26). Supports initialize, notifications/initialized, ping, tools/list, and tools/call for get_studio_packages and create_quote_request.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JsonRpcRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JSON-RPC 2.0 response payload or SSE event stream.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonRpcResponse"
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string",
                  "description": "Server-Sent Events stream carrying JSON-RPC 2.0 response messages."
                }
              }
            }
          },
          "202": {
            "description": "JSON-RPC notification accepted (e.g., notifications/initialized)."
          },
          "400": {
            "description": "Malformed JSON-RPC request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonRpcResponse"
                }
              }
            }
          }
        }
      }
    },
    "/ask": {
      "post": {
        "operationId": "askNlweb",
        "summary": "Query Dellano Sanz knowledge base via NLWeb v0.55 (POST)",
        "description": "Natural-language search and answer endpoint implementing NLWeb v0.55 across studio info, BRL photography packages, films, workshops, and AI software (FECHO, PhotoOS, AfterCutting, AfterColor, Harmony Sync). Supports JSON and SSE streaming via prefer.streaming.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NlwebAskRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "NLWeb v0.55 answer payload or SSE stream.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NlwebAskResponse"
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string",
                  "description": "NLWeb v0.55 SSE stream emitting start, result, and complete events."
                }
              }
            }
          },
          "400": {
            "description": "Missing or invalid query text.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StructuredErrorResponse"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "askNlwebQuery",
        "summary": "Query Dellano Sanz knowledge base via NLWeb v0.55 (GET)",
        "description": "GET variant of the NLWeb v0.55 natural-language query endpoint supporting query and optional streaming query parameters.",
        "parameters": [
          {
            "name": "query",
            "in": "query",
            "required": true,
            "description": "Natural-language question or search query.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "streaming",
            "in": "query",
            "required": false,
            "description": "Set to true to receive an NLWeb v0.55 text/event-stream response.",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "NLWeb v0.55 answer payload or SSE stream.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NlwebAskResponse"
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string",
                  "description": "NLWeb v0.55 SSE stream emitting start, result, and complete events."
                }
              }
            }
          },
          "400": {
            "description": "Missing query parameter.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StructuredErrorResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "StudioPackage": {
        "type": "object",
        "required": ["id", "name", "category", "price", "priceFormatted", "currency", "description"],
        "properties": {
          "id": { "type": "string" },
          "name": { "type": "string" },
          "category": { "type": "string" },
          "price": { "type": "number" },
          "priceFormatted": { "type": "string" },
          "currency": { "type": "string", "const": "BRL" },
          "description": { "type": "string" },
          "location": { "type": "string" }
        }
      },
      "PackageListResponse": {
        "type": "object",
        "required": ["studio", "location", "currency", "count", "packages"],
        "properties": {
          "studio": { "type": "string" },
          "location": { "type": "string" },
          "currency": { "type": "string", "const": "BRL" },
          "count": { "type": "integer" },
          "packages": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/StudioPackage" }
          }
        }
      },
      "QuoteRequestInput": {
        "type": "object",
        "required": ["name", "service", "date"],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 2,
            "description": "Client full name."
          },
          "service": {
            "type": "string",
            "minLength": 2,
            "description": "Desired photography package or audiovisual service."
          },
          "date": {
            "type": "string",
            "format": "date",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
            "description": "Target event or session date in YYYY-MM-DD format."
          }
        }
      },
      "QuoteResponse": {
        "type": "object",
        "required": ["status", "quote"],
        "properties": {
          "status": { "type": "string" },
          "quote": {
            "type": "object",
            "properties": {
              "clientName": { "type": "string" },
              "requestedService": { "type": "string" },
              "date": { "type": "string", "format": "date" },
              "matchedPackage": {
                "oneOf": [
                  { "$ref": "#/components/schemas/StudioPackage" },
                  { "type": "null" }
                ]
              },
              "estimatedPriceBRL": {
                "type": ["number", "null"]
              },
              "studioLocation": { "type": "string" }
            }
          },
          "confirmation": {
            "type": "object",
            "properties": {
              "whatsappUrl": { "type": "string", "format": "uri" },
              "email": { "type": "string", "format": "email" },
              "contactPage": { "type": "string", "format": "uri" }
            }
          }
        }
      },
      "ContactRequestInput": {
        "type": "object",
        "required": ["name", "email", "message", "startedAt"],
        "properties": {
          "name": { "type": "string", "minLength": 2 },
          "email": { "type": "string", "format": "email" },
          "subject": { "type": "string" },
          "message": { "type": "string", "minLength": 10 },
          "startedAt": { "type": "number", "description": "Client epoch timestamp (ms) when the form opened." },
          "company": { "type": "string", "description": "Optional honeypot field; must remain empty for genuine submissions." }
        }
      },
      "ContactSuccessResponse": {
        "type": "object",
        "required": ["ok", "configured"],
        "properties": {
          "ok": { "type": "boolean" },
          "configured": { "type": "boolean" }
        }
      },
      "ContactErrorResponse": {
        "type": "object",
        "required": ["message"],
        "properties": {
          "message": { "type": "string" }
        }
      },
      "JsonRpcRequest": {
        "type": "object",
        "required": ["jsonrpc", "method"],
        "properties": {
          "jsonrpc": { "type": "string", "const": "2.0" },
          "id": { "type": ["string", "integer", "null"] },
          "method": { "type": "string" },
          "params": { "type": "object", "additionalProperties": true }
        }
      },
      "JsonRpcResponse": {
        "type": "object",
        "required": ["jsonrpc"],
        "properties": {
          "jsonrpc": { "type": "string", "const": "2.0" },
          "id": { "type": ["string", "integer", "null"] },
          "result": { "type": "object", "additionalProperties": true },
          "error": {
            "type": "object",
            "properties": {
              "code": { "type": "integer" },
              "message": { "type": "string" },
              "data": {}
            }
          }
        }
      },
      "NlwebAskRequest": {
        "type": "object",
        "required": ["query"],
        "properties": {
          "query": {
            "type": "object",
            "required": ["text"],
            "properties": {
              "text": { "type": "string", "minLength": 1 }
            }
          },
          "prefer": {
            "type": "object",
            "properties": {
              "streaming": { "type": "boolean" }
            }
          }
        }
      },
      "NlwebAskResponse": {
        "type": "object",
        "required": ["_meta", "results"],
        "properties": {
          "_meta": {
            "type": "object",
            "required": ["response_type", "version"],
            "properties": {
              "response_type": { "type": "string" },
              "version": { "type": "string", "const": "0.55" }
            }
          },
          "results": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "@type": { "type": "string" },
                "name": { "type": "string" },
                "url": { "type": "string", "format": "uri" },
                "description": { "type": "string" },
                "score": { "type": "number" }
              }
            }
          }
        }
      },
      "StructuredErrorResponse": {
        "type": "object",
        "required": ["error"],
        "properties": {
          "error": {
            "type": "object",
            "required": ["code", "message"],
            "properties": {
              "code": { "type": "string" },
              "message": { "type": "string" },
              "hint": { "type": "string" },
              "fields": {
                "type": "object",
                "additionalProperties": { "type": "string" }
              }
            }
          }
        }
      }
    }
  }
}
