{
  "openapi": "3.1.0",
  "info": {
    "title": "Ensenada Total API",
    "version": "1.0.0",
    "description": "Directorio de lugares para comer en Ensenada, Baja California, y el Valle de Guadalupe. Público, de solo lectura y sin autenticación.",
    "contact": {
      "url": "https://ensenadatotal.com/para-agentes/"
    }
  },
  "servers": [
    {
      "url": "https://ensenadatotal.com"
    }
  ],
  "paths": {
    "/api/lugares.json": {
      "get": {
        "operationId": "listarLugares",
        "summary": "Todos los lugares con horario, coordenadas y fuente",
        "responses": {
          "200": {
            "description": "Listado completo",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "actualizado": {
                      "type": "string"
                    },
                    "total": {
                      "type": "integer"
                    },
                    "lugares": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Lugar"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/hospedaje.json": {
      "get": {
        "operationId": "listarHospedaje",
        "summary": "Hoteles, cabañas, glamping y moteles con servicios, cercanía a la Calle Primera y precio de referencia",
        "responses": {
          "200": {
            "description": "Listado completo",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "total": {
                      "type": "integer"
                    },
                    "hospedaje": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Hospedaje"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/zonas.json": {
      "get": {
        "operationId": "listarZonas",
        "summary": "Zonas y antojos con conteos",
        "responses": {
          "200": {
            "description": "Zonas y antojos",
            "content": {
              "application/json": {}
            }
          }
        }
      }
    },
    "/api/estado.json": {
      "get": {
        "operationId": "estado",
        "summary": "Estado del servicio",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {}
            }
          }
        }
      }
    },
    "/mcp": {
      "post": {
        "operationId": "mcp",
        "summary": "Servidor MCP (Streamable HTTP, JSON-RPC 2.0)",
        "description": "Herramientas: buscar_lugares, ver_lugar, listar_zonas, buscar_hospedaje, ver_hospedaje.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Respuesta JSON-RPC",
            "content": {
              "application/json": {}
            }
          },
          "202": {
            "description": "Notificación aceptada"
          }
        }
      }
    },
    "/a2a": {
      "post": {
        "operationId": "a2a",
        "summary": "Agente A2A (JSON-RPC 2.0, message/send)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Mensaje del agente",
            "content": {
              "application/json": {}
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Lugar": {
        "type": "object",
        "properties": {
          "slug": {
            "type": "string"
          },
          "nombre": {
            "type": "string"
          },
          "tipo": {
            "type": "string",
            "enum": [
              "carreta",
              "taqueria",
              "restaurante",
              "rapida",
              "cafe",
              "foodtruck",
              "mercado",
              "cerveceria"
            ]
          },
          "zona": {
            "type": "string",
            "enum": [
              "centro",
              "primera",
              "mercado",
              "colonias",
              "sauzal",
              "maneadero",
              "bufadora",
              "valle",
              "ubicar"
            ]
          },
          "zona_nombre": {
            "type": "string"
          },
          "direccion": {
            "type": "string"
          },
          "telefono": {
            "type": [
              "string",
              "null"
            ]
          },
          "web": {
            "type": [
              "string",
              "null"
            ]
          },
          "categorias": {
            "type": [
              "string",
              "null"
            ]
          },
          "antojos": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "pescado",
                "mariscos",
                "asada",
                "birria",
                "desayuno",
                "antojitos",
                "hamburguesa",
                "hotdog",
                "pizza",
                "asiatica",
                "cafe",
                "alta",
                "vino"
              ]
            }
          },
          "precio": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1,
            "maximum": 4
          },
          "precio_estimado": {
            "type": "boolean"
          },
          "monto": {
            "type": [
              "string",
              "null"
            ]
          },
          "recomendacion": {
            "type": [
              "string",
              "null"
            ]
          },
          "michelin": {
            "type": [
              "string",
              "null"
            ]
          },
          "horario": {
            "type": [
              "object",
              "null"
            ],
            "description": "Por día (domingo…sabado): lista de [abre, cierra] en HH:MM, hora de Ensenada. Si cierra < abre, cierra al día siguiente.",
            "additionalProperties": {
              "type": "array",
              "items": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "minItems": 2,
                "maxItems": 2
              }
            }
          },
          "lat": {
            "type": [
              "number",
              "null"
            ]
          },
          "lng": {
            "type": [
              "number",
              "null"
            ]
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "google_maps": {
            "type": "string",
            "format": "uri"
          },
          "fuente": {
            "type": "string"
          },
          "ficha_propia": {
            "type": "boolean"
          },
          "fuente_antigua": {
            "type": "boolean"
          },
          "verificado_en_visita": {
            "type": "boolean"
          },
          "rank": {
            "type": "integer"
          }
        }
      },
      "Hospedaje": {
        "type": "object",
        "properties": {
          "slug": {
            "type": "string"
          },
          "nombre": {
            "type": "string"
          },
          "tipo": {
            "type": "string",
            "enum": [
              "hotel",
              "boutique",
              "motel",
              "hostal",
              "bnb",
              "posada",
              "cabana",
              "glamping",
              "resort",
              "vacacional"
            ]
          },
          "zona": {
            "type": "string",
            "enum": [
              "centro",
              "primera",
              "mercado",
              "colonias",
              "sauzal",
              "maneadero",
              "bufadora",
              "valle",
              "ubicar"
            ]
          },
          "direccion": {
            "type": "string"
          },
          "telefono": {
            "type": [
              "string",
              "null"
            ]
          },
          "web": {
            "type": [
              "string",
              "null"
            ]
          },
          "estrellas": {
            "type": [
              "integer",
              "null"
            ]
          },
          "servicios": {
            "type": "object",
            "additionalProperties": {
              "type": "boolean"
            }
          },
          "precio_referencia": {
            "type": [
              "object",
              "null"
            ]
          },
          "a_pie_calle_primera_min": {
            "type": [
              "integer",
              "null"
            ]
          },
          "lugares_para_comer_10_min": {
            "type": "integer"
          },
          "lat": {
            "type": "number"
          },
          "lng": {
            "type": "number"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "booking": {
            "type": "string",
            "format": "uri"
          },
          "verificado_en_visita": {
            "type": "boolean"
          }
        }
      }
    }
  }
}