{
  "openapi": "3.1.0",
  "info": {
    "title": "michy — API pública",
    "version": "1.0.0",
    "summary": "Datos de la cafetería michy (Torremolinos) en JSON, para agentes y asistentes de IA.",
    "description": "API estática de solo lectura y sin autenticación. Expone la ficha del negocio (dirección, horarios, contacto) y la carta. Informa: no permite hacer pedidos ni reservas.",
    "contact": { "name": "michy", "email": "info@michycoffee.com", "url": "https://michycoffee.com/" },
    "license": { "name": "Uso libre con atribución a michycoffee.com", "url": "https://michycoffee.com/aviso-legal.html" }
  },
  "servers": [{ "url": "https://michycoffee.com", "description": "Producción" }],
  "paths": {
    "/api/v1/business.json": {
      "get": {
        "operationId": "getBusiness",
        "summary": "Ficha del negocio",
        "description": "Dirección, horarios de apertura, teléfono, email y estado del negocio.",
        "tags": ["michy"],
        "responses": {
          "200": {
            "description": "Ficha del negocio",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Business" } } }
          }
        }
      }
    },
    "/api/v1/menu.json": {
      "get": {
        "operationId": "getMenu",
        "summary": "Carta",
        "description": "Categorías, platos y precios. Es la misma carta que carta.pdf.",
        "tags": ["michy"],
        "responses": {
          "200": {
            "description": "Carta",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Menu" } } }
          }
        }
      }
    },
    "/api/v1/status.json": {
      "get": {
        "operationId": "getStatus",
        "summary": "Estado de la API",
        "tags": ["michy"],
        "responses": {
          "200": {
            "description": "Estado",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Status" } } }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Business": {
        "type": "object",
        "required": ["name", "status", "address", "contact", "openingHours"],
        "properties": {
          "name": { "type": "string" },
          "legalName": { "type": "string" },
          "status": { "type": "string", "enum": ["pre-opening", "open"] },
          "description": { "type": "string" },
          "url": { "type": "string", "format": "uri" },
          "timezone": { "type": "string" },
          "address": {
            "type": "object",
            "properties": {
              "streetAddress": { "type": "string" },
              "postalCode": { "type": "string" },
              "addressLocality": { "type": "string" },
              "addressRegion": { "type": "string" },
              "addressCountry": { "type": "string" }
            }
          },
          "contact": {
            "type": "object",
            "properties": {
              "email": { "type": "string", "format": "email" },
              "telephone": { "type": "string" },
              "instagram": { "type": "string", "format": "uri" }
            }
          },
          "openingHours": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "dayOfWeek": { "type": "string" },
                "opens": { "type": "string", "examples": ["08:30"] },
                "closes": { "type": "string", "examples": ["15:30"] },
                "closed": { "type": "boolean" }
              }
            }
          },
          "features": { "type": "object", "additionalProperties": { "type": "boolean" } }
        }
      },
      "Menu": {
        "type": "object",
        "required": ["currency", "categories"],
        "properties": {
          "currency": { "type": "string", "examples": ["EUR"] },
          "source": { "type": "string", "format": "uri" },
          "updated": { "type": "string", "format": "date" },
          "allergens": { "type": "string", "description": "Cómo se consulta la información de alérgenos." },
          "categories": {
            "type": "array",
            "items": {
              "type": "object",
              "required": ["id", "name", "items"],
              "properties": {
                "id": { "type": "string" },
                "name": { "type": "string" },
                "note": { "type": "string", "description": "Lo que la carta aclara sobre la categoría entera." },
                "priceRange": {
                  "type": "object",
                  "properties": { "min": { "type": "number" }, "max": { "type": "number" } }
                },
                "items": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "required": ["name"],
                    "properties": {
                      "name": { "type": "string" },
                      "description": { "type": "string", "description": "Los ingredientes, como aparecen en la carta." },
                      "price": { "type": "number", "description": "Precio único." },
                      "prices": {
                        "type": "array",
                        "description": "Dos tamaños, pequeño y grande, para los articulos que la carta ofrece en ambos. Excluyente con 'price'.",
                        "items": { "type": "number" },
                        "minItems": 2,
                        "maxItems": 2
                      },
                      "dietary": { "type": "array", "items": { "type": "string" } }
                    }
                  }
                }
              }
            }
          },
          "extras": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": { "type": "string" },
                "price": { "type": "number" },
                "appliesTo": { "type": "string", "examples": ["comida", "bebidas", "pancakes"] },
                "note": { "type": "string" }
              }
            }
          }
        }
      },
      "Status": {
        "type": "object",
        "properties": {
          "status": { "type": "string", "examples": ["operational"] },
          "businessStatus": { "type": "string" },
          "version": { "type": "string" }
        }
      }
    }
  }
}
