{
  "openapi": "3.1.0",
  "info": {
    "title": "La Excelente Pizzer\u00eda Napolitana API",
    "version": "1.0.0",
    "description": "API oficial y especificaci\u00f3n de herramientas de IA para La Excelente Pizzer\u00eda Napolitana en Providencia, Santiago de Chile. Permite consultar la carta de pizzas y antipastos con precios en CLP, verificar horarios de atenci\u00f3n en tiempo real, obtener enlaces oficiales de delivery y generar \u00f3rdenes por WhatsApp.",
    "termsOfService": "https://laexcelente.cl/privacy/",
    "contact": {
      "name": "Soporte T\u00e9cnico La Excelente",
      "url": "https://laexcelente.cl/developers/",
      "email": "contacto@laexcelente.cl"
    },
    "license": {
      "name": "MIT",
      "url": "https://opensource.org/licenses/MIT"
    },
    "x-versioning-policy": {
      "strategy": "URI path versioning (/v1/)",
      "current_version": "v1",
      "deprecation_policy": "RFC 8594 Sunset and Deprecation headers are served on obsolete endpoints with a minimum 6-month deprecation period prior to retirement.",
      "status": "Active"
    },
    "x-pricing": {
      "tier": "Free / Public",
      "rate_limit": "100 req/min",
      "authentication": "Zero-auth required for read operations. Optional self-serve API keys available at POST /api/v1/keys."
    }
  },
  "servers": [
    {
      "url": "https://laexcelente.cl/api/v1",
      "description": "Servidor Oficial de Producci\u00f3n v1"
    },
    {
      "url": "https://laexcelente.cl/api",
      "description": "Alias no versionado"
    }
  ],
  "paths": {
    "/health": {
      "get": {
        "summary": "Estado del servicio",
        "description": "Verifica el estado operativo y la disponibilidad de la API de La Excelente.",
        "operationId": "getHealthStatus",
        "tags": [
          "Sistema"
        ],
        "responses": {
          "200": {
            "description": "Servicio saludable y operativo",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "status",
                    "timestamp",
                    "version"
                  ],
                  "properties": {
                    "status": {
                      "type": "string",
                      "example": "ok"
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time",
                      "example": "2026-08-28T18:00:00.000Z"
                    },
                    "version": {
                      "type": "string",
                      "example": "1.0.0"
                    },
                    "service": {
                      "type": "string",
                      "example": "laexcelente-api"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/menu": {
      "get": {
        "summary": "Obtener carta gastron\u00f3mica completa",
        "description": "Retorna todos los antipastos, pizzas napolitanas rojas y blancas, ensaladas, postres y bebestibles con sus precios en pesos chilenos (CLP), descripci\u00f3n de ingredientes y badges de disponibilidad.",
        "operationId": "getRestaurantMenu",
        "tags": [
          "Carta"
        ],
        "parameters": [
          {
            "name": "category",
            "in": "query",
            "required": false,
            "description": "Filtrar por categor\u00eda espec\u00edfica",
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "antipastos",
                "pizzas_rojas",
                "pizzas_blancas",
                "ensaladas",
                "postres",
                "bebestibles"
              ],
              "default": "all"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Carta gastron\u00f3mica completa estructurada",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "restaurant",
                    "currency",
                    "menu"
                  ],
                  "properties": {
                    "restaurant": {
                      "type": "string",
                      "example": "La Excelente Pizzer\u00eda Napolitana"
                    },
                    "currency": {
                      "type": "string",
                      "example": "CLP"
                    },
                    "menu": {
                      "type": "object",
                      "required": [
                        "antipastos",
                        "pizzas_rojas",
                        "pizzas_blancas",
                        "ensaladas",
                        "postres",
                        "bebestibles"
                      ],
                      "properties": {
                        "antipastos": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/MenuItem"
                          }
                        },
                        "pizzas_rojas": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/MenuItem"
                          }
                        },
                        "pizzas_blancas": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/MenuItem"
                          }
                        },
                        "ensaladas": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/MenuItem"
                          }
                        },
                        "postres": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/MenuItem"
                          }
                        },
                        "bebestibles": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/MenuItem"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/restaurant": {
      "get": {
        "summary": "Obtener detalles del restaurante",
        "description": "Retorna informaci\u00f3n institucional: direcci\u00f3n f\u00edsica en Providencia, tel\u00e9fono, coordenadas geogr\u00e1ficas, horarios y redes sociales.",
        "operationId": "getRestaurantDetails",
        "tags": [
          "Restaurante"
        ],
        "responses": {
          "200": {
            "description": "Datos completos de La Excelente Pizzer\u00eda",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "name",
                    "address",
                    "phone",
                    "geo"
                  ],
                  "properties": {
                    "name": {
                      "type": "string",
                      "example": "La Excelente Pizzer\u00eda Napolitana"
                    },
                    "address": {
                      "type": "object",
                      "required": [
                        "street",
                        "commune",
                        "city",
                        "country"
                      ],
                      "properties": {
                        "street": {
                          "type": "string",
                          "example": "Obispo Hip\u00f3lito Salas 0381"
                        },
                        "commune": {
                          "type": "string",
                          "example": "Providencia"
                        },
                        "city": {
                          "type": "string",
                          "example": "Santiago"
                        },
                        "country": {
                          "type": "string",
                          "example": "CL"
                        },
                        "postalCode": {
                          "type": "string",
                          "example": "7500409"
                        }
                      }
                    },
                    "phone": {
                      "type": "string",
                      "example": "+56966750334"
                    },
                    "geo": {
                      "type": "object",
                      "required": [
                        "latitude",
                        "longitude"
                      ],
                      "properties": {
                        "latitude": {
                          "type": "number",
                          "example": -33.437596
                        },
                        "longitude": {
                          "type": "number",
                          "example": -70.6282372
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/hours": {
      "get": {
        "summary": "Verificar horarios y estado en vivo",
        "description": "Calcula si la pizzer\u00eda est\u00e1 abierta en este momento seg\u00fan la hora oficial de Santiago de Chile (America/Santiago).",
        "operationId": "getOpeningHoursStatus",
        "tags": [
          "Restaurante"
        ],
        "responses": {
          "200": {
            "description": "Estado de atenci\u00f3n actual y turnos semanales",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "is_open",
                    "timezone",
                    "schedule"
                  ],
                  "properties": {
                    "is_open": {
                      "type": "boolean",
                      "example": true
                    },
                    "timezone": {
                      "type": "string",
                      "example": "America/Santiago"
                    },
                    "schedule": {
                      "type": "string",
                      "example": "Martes a S\u00e1bado 12:30-16:00 y 19:00-22:00, Domingo y Lunes cerrado"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/delivery": {
      "get": {
        "summary": "Obtener canales de delivery oficiales",
        "description": "Retorna enlaces directos para pedir comida a domicilio en PedidosYa, Uber Eats, Rappi y WhatsApp.",
        "operationId": "getDeliveryOptions",
        "tags": [
          "Delivery"
        ],
        "responses": {
          "200": {
            "description": "Enlaces verificados de delivery",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "pedidosya",
                    "ubereats",
                    "rappi",
                    "whatsapp"
                  ],
                  "properties": {
                    "pedidosya": {
                      "type": "string",
                      "format": "uri"
                    },
                    "ubereats": {
                      "type": "string",
                      "format": "uri"
                    },
                    "rappi": {
                      "type": "string",
                      "format": "uri"
                    },
                    "whatsapp": {
                      "type": "string",
                      "format": "uri"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/keys": {
      "post": {
        "summary": "Generar llave API de autoservicio o sandbox",
        "description": "Genera credenciales de acceso instant\u00e1neo para agentes aut\u00f3nomos y entornos de prueba sin registro previo.",
        "operationId": "generateApiKey",
        "tags": [
          "Autenticaci\u00f3n"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "tier": {
                    "type": "string",
                    "enum": [
                      "sandbox",
                      "free"
                    ],
                    "default": "sandbox"
                  },
                  "agent_name": {
                    "type": "string",
                    "example": "AutonomousAgent"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Llave API generada exitosamente",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "status",
                    "tier",
                    "api_key",
                    "rate_limit"
                  ],
                  "properties": {
                    "status": {
                      "type": "string",
                      "example": "active"
                    },
                    "tier": {
                      "type": "string",
                      "example": "sandbox"
                    },
                    "api_key": {
                      "type": "string",
                      "example": "lex_sandbox_9f8a7c6b5d4e"
                    },
                    "rate_limit": {
                      "type": "string",
                      "example": "100 req/min"
                    },
                    "features": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/mcp": {
      "post": {
        "summary": "Protocolo Model Context Protocol (MCP)",
        "description": "Endpoint JSON-RPC 2.0 compatible con clientes MCP como Claude Desktop y agentes OpenAI/LangChain.",
        "operationId": "executeMcpJsonRpc",
        "tags": [
          "MCP"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "jsonrpc",
                  "method"
                ],
                "properties": {
                  "jsonrpc": {
                    "type": "string",
                    "example": "2.0"
                  },
                  "id": {
                    "type": "integer",
                    "example": 1
                  },
                  "method": {
                    "type": "string",
                    "enum": [
                      "initialize",
                      "ping",
                      "tools/list",
                      "tools/call"
                    ]
                  },
                  "params": {
                    "type": "object"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Respuesta JSON-RPC 2.0",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "jsonrpc",
                    "id"
                  ],
                  "properties": {
                    "jsonrpc": {
                      "type": "string",
                      "example": "2.0"
                    },
                    "id": {
                      "type": "integer",
                      "example": 1
                    },
                    "result": {
                      "type": "object"
                    },
                    "error": {
                      "$ref": "#/components/schemas/ApiError"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/order/whatsapp": {
      "post": {
        "summary": "Generar enlace de pedido por WhatsApp",
        "description": "Crea una URL codificada para enviar un pedido preformateado directamente al n\u00famero de WhatsApp de La Excelente.",
        "operationId": "generateWhatsAppOrder",
        "tags": [
          "Pedidos"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "items",
                  "delivery_method"
                ],
                "properties": {
                  "items": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "type": "object",
                      "required": [
                        "name",
                        "quantity",
                        "price_numeric"
                      ],
                      "properties": {
                        "name": {
                          "type": "string",
                          "example": "Margarita"
                        },
                        "quantity": {
                          "type": "integer",
                          "minimum": 1,
                          "example": 2
                        },
                        "price_numeric": {
                          "type": "integer",
                          "example": 10000
                        }
                      }
                    }
                  },
                  "delivery_method": {
                    "type": "string",
                    "enum": [
                      "delivery",
                      "pickup"
                    ],
                    "example": "delivery"
                  },
                  "customer_name": {
                    "type": "string",
                    "example": "Carlos Saunier"
                  },
                  "address": {
                    "type": "string",
                    "example": "Av. Providencia 1234, Depto 501"
                  },
                  "notes": {
                    "type": "string",
                    "example": "Sin picante por favor"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Enlace de WhatsApp generado",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "whatsapp_url",
                    "total_clp",
                    "formatted_message"
                  ],
                  "properties": {
                    "whatsapp_url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "total_clp": {
                      "type": "integer",
                      "example": 20000
                    },
                    "formatted_message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "MenuItem": {
        "type": "object",
        "required": [
          "name",
          "price",
          "price_numeric",
          "description"
        ],
        "properties": {
          "name": {
            "type": "string",
            "example": "Margarita"
          },
          "number": {
            "type": "string",
            "example": "01"
          },
          "description": {
            "type": "string",
            "example": "Pomodoro San Marzano, mozzarella fior di latte, albahaca fresca, AOEV"
          },
          "price": {
            "type": "string",
            "example": "$10.000"
          },
          "price_numeric": {
            "type": "integer",
            "example": 10000
          },
          "category": {
            "type": "string",
            "example": "pizzas_rojas"
          },
          "badge": {
            "type": "string",
            "example": "Cl\u00e1sica"
          }
        }
      },
      "ApiError": {
        "type": "object",
        "required": [
          "code",
          "message"
        ],
        "properties": {
          "code": {
            "type": "integer",
            "example": 404
          },
          "message": {
            "type": "string",
            "example": "Resource not found"
          },
          "resolution": {
            "type": "string",
            "example": "Check https://laexcelente.cl/openapi.json for valid routes."
          }
        }
      }
    }
  }
}