{
  "openapi": "3.1.0",
  "info": {
    "title": "OLA Vital Center: API pública y OAuth",
    "version": "1.0.0",
    "description": "Lo que un agente puede llamar en OLA Vital Center (salón por membresía en San Luis Potosí): catálogo, sucursales, reserva pública, OAuth 2.1 con registro dinámico de cliente y los servidores MCP. Guía de credenciales: https://olavital.com/auth.md"
  },
  "servers": [
    {
      "url": "https://app.olavital.com",
      "description": "Producción"
    }
  ],
  "security": [],
  "paths": {
    "/.well-known/oauth-authorization-server": {
      "get": {
        "operationId": "getWellKnownOauthAuthorizationServer",
        "summary": "GET /.well-known/oauth-authorization-server",
        "tags": [
          "agentes"
        ],
        "security": [],
        "x-ola-acceso": "publica",
        "x-ola-uso": "agentes",
        "x-ola-sin-tipo": true,
        "responses": {
          "200": {
            "description": "Correcta",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/.well-known/oauth-protected-resource": {
      "get": {
        "operationId": "getWellKnownOauthProtectedResource",
        "summary": "GET /.well-known/oauth-protected-resource",
        "tags": [
          "agentes"
        ],
        "security": [],
        "x-ola-acceso": "publica",
        "x-ola-uso": "agentes",
        "x-ola-sin-tipo": true,
        "responses": {
          "200": {
            "description": "Correcta",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/.well-known/oauth-protected-resource/api/mcp": {
      "get": {
        "operationId": "getWellKnownOauthProtectedResourceApiMcp",
        "summary": "GET /.well-known/oauth-protected-resource/api/mcp",
        "tags": [
          "agentes"
        ],
        "security": [],
        "x-ola-acceso": "publica",
        "x-ola-uso": "agentes",
        "x-ola-sin-tipo": true,
        "responses": {
          "200": {
            "description": "Correcta",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/.well-known/oauth-protected-resource/api/mcp/admin": {
      "get": {
        "operationId": "getWellKnownOauthProtectedResourceApiMcpAdmin",
        "summary": "GET /.well-known/oauth-protected-resource/api/mcp/admin",
        "tags": [
          "agentes"
        ],
        "security": [],
        "x-ola-acceso": "publica",
        "x-ola-uso": "agentes",
        "x-ola-sin-tipo": true,
        "responses": {
          "200": {
            "description": "Correcta",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/mcp": {
      "get": {
        "operationId": "getMcp",
        "summary": "GET /api/mcp",
        "tags": [
          "agentes"
        ],
        "security": [],
        "x-ola-acceso": "publica",
        "x-ola-uso": "agentes",
        "x-ola-sin-tipo": true,
        "responses": {
          "200": {
            "description": "Correcta",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "post": {
        "operationId": "postMcp",
        "summary": "POST /api/mcp",
        "tags": [
          "agentes"
        ],
        "security": [
          {
            "oauth2": [
              "ola.membresia",
              "ola.citas",
              "ola.pagos"
            ]
          }
        ],
        "x-ola-acceso": "autenticada",
        "x-ola-uso": "agentes",
        "x-ola-sin-tipo": true,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {}
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Correcta",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/mcp/admin": {
      "get": {
        "operationId": "getMcpAdmin",
        "summary": "GET /api/mcp/admin",
        "tags": [
          "agentes"
        ],
        "security": [],
        "x-ola-acceso": "publica",
        "x-ola-uso": "agentes",
        "x-ola-sin-tipo": true,
        "responses": {
          "200": {
            "description": "Correcta",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "post": {
        "operationId": "postMcpAdmin",
        "summary": "POST /api/mcp/admin",
        "tags": [
          "agentes"
        ],
        "security": [
          {
            "oauth2": [
              "ola.admin",
              "ola.admin.acciones"
            ]
          }
        ],
        "x-ola-acceso": "autenticada",
        "x-ola-uso": "agentes",
        "x-ola-sin-tipo": true,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {}
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Correcta",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/mcp/publico": {
      "get": {
        "operationId": "getMcpPublico",
        "summary": "GET /api/mcp/publico",
        "tags": [
          "agentes"
        ],
        "security": [],
        "x-ola-acceso": "publica",
        "x-ola-uso": "agentes",
        "x-ola-sin-tipo": true,
        "responses": {
          "200": {
            "description": "Correcta",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "post": {
        "operationId": "postMcpPublico",
        "summary": "POST /api/mcp/publico",
        "tags": [
          "agentes"
        ],
        "security": [],
        "x-ola-acceso": "publica",
        "x-ola-uso": "agentes",
        "x-ola-sin-tipo": true,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {}
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Correcta",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/oauth/autorizar": {
      "post": {
        "operationId": "postOauthAutorizar",
        "summary": "POST /api/oauth/autorizar",
        "tags": [
          "agentes"
        ],
        "security": [],
        "x-ola-acceso": "autenticada",
        "x-ola-uso": "agentes",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SolicitudAutorizacion"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Correcta",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "redirect_to": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "redirect_to"
                  ]
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/oauth/cliente": {
      "get": {
        "operationId": "getOauthCliente",
        "summary": "GET /api/oauth/cliente",
        "tags": [
          "agentes"
        ],
        "security": [],
        "x-ola-acceso": "publica",
        "x-ola-uso": "agentes",
        "parameters": [
          {
            "name": "client_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "redirect_uri",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Correcta",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ClienteOAuth"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/oauth/registro": {
      "post": {
        "operationId": "postOauthRegistro",
        "summary": "POST /api/oauth/registro",
        "tags": [
          "agentes"
        ],
        "security": [],
        "x-ola-acceso": "publica",
        "x-ola-uso": "agentes",
        "x-ola-sin-tipo": true,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {}
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Creada",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/oauth/token": {
      "post": {
        "operationId": "postOauthToken",
        "summary": "POST /api/oauth/token",
        "tags": [
          "agentes"
        ],
        "security": [],
        "x-ola-acceso": "publica",
        "x-ola-uso": "agentes",
        "x-ola-sin-tipo": true,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {}
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Correcta",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/public/catalog": {
      "get": {
        "operationId": "getPublicCatalog",
        "summary": "GET /api/public/catalog",
        "tags": [
          "public"
        ],
        "security": [],
        "x-ola-acceso": "publica",
        "responses": {
          "200": {
            "description": "Correcta",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Catalogo"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/public/contrato": {
      "get": {
        "operationId": "getPublicContrato",
        "summary": "GET /api/public/contrato",
        "tags": [
          "public"
        ],
        "security": [],
        "x-ola-acceso": "publica",
        "responses": {
          "200": {
            "description": "Correcta",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RespuestaContratoPublico"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/public/leads": {
      "options": {
        "operationId": "optionsPublicLeads",
        "summary": "OPTIONS /api/public/leads",
        "tags": [
          "public"
        ],
        "security": [],
        "x-ola-acceso": "publica",
        "x-ola-uso": "sitio",
        "responses": {
          "204": {
            "description": "Sin contenido"
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "post": {
        "operationId": "postPublicLeads",
        "summary": "POST /api/public/leads",
        "tags": [
          "public"
        ],
        "security": [],
        "x-ola-acceso": "publica",
        "x-ola-uso": "sitio",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {}
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Creada",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id"
                  ]
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/public/reserva/{intentId}/estado": {
      "get": {
        "operationId": "getPublicReservaPorIntentIdEstado",
        "summary": "GET /api/public/reserva/:intentId/estado",
        "tags": [
          "public"
        ],
        "security": [],
        "x-ola-acceso": "publica",
        "parameters": [
          {
            "name": "intentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sucursal",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Correcta",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EstadoReservaPublicaDto"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/public/reserva/checkout": {
      "post": {
        "operationId": "postPublicReservaCheckout",
        "summary": "POST /api/public/reserva/checkout",
        "tags": [
          "public"
        ],
        "security": [],
        "x-ola-acceso": "publica",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PeticionCheckoutReservaPublicaDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Creada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RespuestaCheckoutReservaPublicaDto"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/public/reserva/horarios": {
      "get": {
        "operationId": "getPublicReservaHorarios",
        "summary": "GET /api/public/reserva/horarios",
        "tags": [
          "public"
        ],
        "security": [],
        "x-ola-acceso": "publica",
        "responses": {
          "200": {
            "description": "Correcta",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HorariosReservaPublicaDto"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/public/reserva/opciones": {
      "get": {
        "operationId": "getPublicReservaOpciones",
        "summary": "GET /api/public/reserva/opciones",
        "tags": [
          "public"
        ],
        "security": [],
        "x-ola-acceso": "publica",
        "responses": {
          "200": {
            "description": "Correcta",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpcionesReservaPublicaDto"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/public/sucursales": {
      "get": {
        "operationId": "getPublicSucursales",
        "summary": "GET /api/public/sucursales",
        "tags": [
          "public"
        ],
        "security": [],
        "x-ola-acceso": "publica",
        "responses": {
          "200": {
            "description": "Correcta",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SucursalesDto"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/public/version": {
      "get": {
        "operationId": "getPublicVersion",
        "summary": "GET /api/public/version",
        "tags": [
          "public"
        ],
        "security": [],
        "x-ola-acceso": "publica",
        "responses": {
          "200": {
            "description": "Correcta",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ios": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/ReglaVersionAppDto"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "android": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/ReglaVersionAppDto"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "ios",
                    "android"
                  ]
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ReglaVersionAppDto": {
        "type": "object",
        "properties": {
          "minima": {
            "description": "Por debajo de esta, la app se bloquea hasta actualizar; null: sin bloqueo.",
            "type": [
              "string",
              "null"
            ]
          },
          "recomendada": {
            "description": "Por debajo de esta (y arriba de la mínima), aviso que se puede cerrar; null: sin aviso.",
            "type": [
              "string",
              "null"
            ]
          },
          "tienda": {
            "description": "Ficha de la app en su tienda.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "minima",
          "recomendada",
          "tienda"
        ]
      },
      "SucursalesDto": {
        "type": "object",
        "properties": {
          "sucursales": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SucursalDto"
            }
          }
        },
        "required": [
          "sucursales"
        ]
      },
      "SucursalDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "nombre": {
            "description": "Nombre completo interno (\"OLA Vital Center · San Luis Potosí\").",
            "type": "string"
          },
          "nombreCorto": {
            "description": "Como se llama en la app (\"Salvador Nava\").",
            "type": "string"
          },
          "zona": {
            "description": "Zona IANA de su agenda.",
            "type": "string"
          },
          "moneda": {
            "description": "Divisa ISO 4217 del tenant/sucursal (MXN por omisión).",
            "type": "string"
          },
          "direccion": {
            "type": [
              "string",
              "null"
            ]
          },
          "ubicacion": {
            "description": "Pin de la ficha; null si aún no se da.",
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "lat": {
                "type": "number"
              },
              "lng": {
                "type": "number"
              }
            },
            "required": [
              "lat",
              "lng"
            ]
          },
          "idLugarGoogle": {
            "description": "Id de lugar de la ficha en Google Maps (ChIJ…); null si no tiene.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "nombre",
          "nombreCorto",
          "zona",
          "direccion",
          "ubicacion",
          "idLugarGoogle"
        ]
      },
      "OpcionesReservaPublicaDto": {
        "type": "object",
        "properties": {
          "sucursalId": {
            "type": "string"
          },
          "sucursalNombre": {
            "type": "string"
          },
          "serviciosSueltos": {
            "description": "duracionMin es la de services: la misma con que la agenda aparta el hueco.",
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string"
                },
                "nombre": {
                  "type": "string"
                },
                "duracionMin": {
                  "type": "number"
                },
                "precioMinor": {
                  "type": "integer"
                }
              },
              "required": [
                "code",
                "nombre",
                "duracionMin",
                "precioMinor"
              ]
            }
          },
          "planesMembresia": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string",
                  "enum": [
                    "brisa",
                    "ola",
                    "marea"
                  ]
                },
                "nombre": {
                  "type": "string"
                },
                "precioMensualMinor": {
                  "type": "integer"
                },
                "descripcion": {
                  "type": "string"
                }
              },
              "required": [
                "code",
                "nombre",
                "precioMensualMinor",
                "descripcion"
              ]
            }
          },
          "pagoEnLinea": {
            "description": "Hay pasarela para cobrar en línea; si no, la reserva se confirma y se cobra en el salón (S-01).",
            "type": "boolean"
          },
          "avisosWhatsApp": {
            "description": "Hay canal de WhatsApp conectado. Sin él la reserva no ofrece recordatorios por WhatsApp ni guarda ese\nconsentimiento: los avisos van por la app.",
            "type": "boolean"
          }
        },
        "required": [
          "sucursalId",
          "sucursalNombre",
          "serviciosSueltos",
          "planesMembresia"
        ]
      },
      "HorariosReservaPublicaDto": {
        "description": "GET /api/public/reserva/horarios?sucursal=&fecha=&servicio= (0034): horas con al menos una estilista libre.",
        "type": "object",
        "properties": {
          "fecha": {
            "type": "string"
          },
          "servicio": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "nombre": {
                "type": "string"
              },
              "duracionMin": {
                "type": "number"
              }
            },
            "required": [
              "code",
              "nombre",
              "duracionMin"
            ]
          },
          "horarios": {
            "description": "hora: HH:MM local de la sucursal; inicio: el mismo instante en ISO 8601 UTC, el que se manda al checkout.",
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "hora": {
                  "type": "string"
                },
                "inicio": {
                  "type": "string"
                }
              },
              "required": [
                "hora",
                "inicio"
              ]
            }
          }
        },
        "required": [
          "fecha",
          "servicio",
          "horarios"
        ]
      },
      "RespuestaCheckoutReservaPublicaDto": {
        "type": "object",
        "properties": {
          "intentId": {
            "type": "string"
          },
          "modalidad": {
            "type": "string",
            "enum": [
              "membresia",
              "cita_suelta"
            ]
          },
          "concepto": {
            "type": "string"
          },
          "subtotalMinor": {
            "type": "integer"
          },
          "descuentoTarjetaRegaloMinor": {
            "type": "integer"
          },
          "totalPagarMinor": {
            "type": "integer"
          },
          "moneda": {
            "description": "ISO 4217 que se cobra (el intento lo guarda junto con el total).",
            "type": "string"
          },
          "sucursalId": {
            "type": "string"
          },
          "estado": {
            "type": "string",
            "enum": [
              "pendiente_pago",
              "convertida"
            ]
          },
          "urlPago": {
            "description": "Checkout del proveedor por el total; null o ausente cuando se paga en el salón.",
            "type": [
              "string",
              "null"
            ]
          },
          "apartadoHasta": {
            "description": "Cita suelta: hasta cuándo queda apartado el horario (ISO); el cobro en línea vence ahí mismo.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "intentId",
          "modalidad",
          "concepto",
          "subtotalMinor",
          "descuentoTarjetaRegaloMinor",
          "totalPagarMinor",
          "estado"
        ]
      },
      "PeticionCheckoutReservaPublicaDto": {
        "type": "object",
        "properties": {
          "sucursal_id": {
            "type": "string"
          },
          "modalidad": {
            "type": "string",
            "enum": [
              "membresia",
              "cita_suelta"
            ]
          },
          "nombre": {
            "type": "string"
          },
          "telefono": {
            "type": "string"
          },
          "correo": {
            "type": "string"
          },
          "servicio_code": {
            "type": "string"
          },
          "plan_code": {
            "type": "string",
            "enum": [
              "brisa",
              "ola",
              "marea"
            ]
          },
          "starts_at_iso": {
            "type": "string"
          },
          "consentimiento_privacidad": {
            "type": "boolean"
          },
          "whatsapp_opt_in": {
            "type": "boolean"
          },
          "codigo_tarjeta_regalo": {
            "type": "string"
          },
          "codigo_referido": {
            "type": "string"
          }
        },
        "required": [
          "modalidad",
          "nombre",
          "telefono",
          "consentimiento_privacidad"
        ]
      },
      "EstadoReservaPublicaDto": {
        "description": "Estado que ve la pantalla de vuelta del pago (§7.6); nada de datos de la persona.",
        "type": "object",
        "properties": {
          "estado": {
            "description": "sin_horario y reembolsada (0034): el pago llegó cuando el horario ya se había ocupado.",
            "type": "string",
            "enum": [
              "confirmada",
              "cancelada",
              "pendiente",
              "sin_horario",
              "reembolsada"
            ]
          }
        },
        "required": [
          "estado"
        ]
      },
      "RespuestaContratoPublico": {
        "description": "GET /api/public/contrato: el contrato vigente del salón, para la pantalla de alta sin cuenta.",
        "type": "object",
        "properties": {
          "vigente": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/TerminosVigentes"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "vigente"
        ]
      },
      "TerminosVigentes": {
        "type": "object",
        "properties": {
          "version": {
            "type": "string"
          },
          "titulo": {
            "type": "string"
          }
        },
        "required": [
          "version",
          "titulo"
        ]
      },
      "Catalogo": {
        "type": "object",
        "properties": {
          "version": {
            "type": "string"
          },
          "provisional": {
            "type": "boolean"
          },
          "nota": {
            "type": "string"
          },
          "moneda": {
            "description": "ISO 4217.",
            "type": "string"
          },
          "precios_incluyen_iva": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "niveles": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CatalogoNivel"
            }
          },
          "servicios": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CatalogoServicio"
            }
          },
          "promociones": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CatalogoPromocion"
            }
          },
          "politicas": {
            "$ref": "#/components/schemas/CatalogoPoliticas"
          },
          "horarios": {
            "description": "Opcional: sale de configuracion.operacion cuando el servidor la tiene.",
            "allOf": [
              {
                "$ref": "#/components/schemas/CatalogoHorarios"
              }
            ]
          }
        },
        "required": [
          "version",
          "provisional",
          "moneda",
          "precios_incluyen_iva",
          "niveles",
          "servicios",
          "promociones",
          "politicas"
        ]
      },
      "CatalogoHorarios": {
        "description": "null = ese día está cerrado.",
        "type": "object",
        "properties": {
          "lunes_viernes": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CatalogoVentana"
              },
              {
                "type": "null"
              }
            ]
          },
          "sabado": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CatalogoVentana"
              },
              {
                "type": "null"
              }
            ]
          },
          "domingo": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CatalogoVentana"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "lunes_viernes",
          "sabado",
          "domingo"
        ]
      },
      "CatalogoVentana": {
        "description": "HH:MM en la zona de la sucursal.",
        "type": "object",
        "properties": {
          "apertura": {
            "type": "string"
          },
          "cierre": {
            "type": "string"
          }
        },
        "required": [
          "apertura",
          "cierre"
        ]
      },
      "CatalogoPoliticas": {
        "type": "object",
        "properties": {
          "cancelacion_horas": {
            "type": "number"
          },
          "regla_reservas": {
            "type": "string"
          }
        }
      },
      "CatalogoPromocion": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string"
          },
          "titulo": {
            "type": "string"
          },
          "descripcion": {
            "type": "string"
          },
          "inicia": {
            "description": "YYYY-MM-DD.",
            "type": "string"
          },
          "termina": {
            "type": [
              "string",
              "null"
            ]
          },
          "niveles": {
            "description": "code de los niveles.",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "cupo_total": {
            "type": [
              "number",
              "null"
            ]
          },
          "cupo_disponible": {
            "description": "Lugares que quedan (≥ 0); null si no se cuenta. Opcional: el sitio usa cupo_total si falta.",
            "type": [
              "number",
              "null"
            ]
          },
          "publicada": {
            "type": "boolean"
          },
          "precios": {
            "description": "Precio mensual de la promoción por code de nivel, en pesos enteros como precio_mensual; null = por\nanunciar. Opcional: sin él (o sin la clave de un nivel) la promoción no tiene precio propio en ese nivel.",
            "type": "object",
            "properties": {},
            "additionalProperties": {
              "type": [
                "number",
                "null"
              ]
            }
          }
        },
        "required": [
          "code",
          "titulo",
          "descripcion",
          "inicia",
          "termina",
          "niveles",
          "cupo_total",
          "publicada"
        ]
      },
      "CatalogoServicio": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string"
          },
          "nombre": {
            "type": "string"
          },
          "duracion_min": {
            "type": "number"
          },
          "descripcion": {
            "type": "string"
          },
          "precio": {
            "description": "Precio de lista en pesos cuando no lo cubre la membresía. Sin precio, cobrarlo en caja pide el PIN de la\ndueña (S3 #12); lo definen Karen y Omar.",
            "type": "number"
          }
        },
        "required": [
          "code",
          "nombre",
          "duracion_min"
        ]
      },
      "CatalogoNivel": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string"
          },
          "nombre": {
            "type": "string"
          },
          "precio_mensual": {
            "description": "En unidades de la moneda (pesos), no en centavos.",
            "type": "number"
          },
          "max_reservas_activas": {
            "type": "number"
          },
          "cupo": {
            "type": [
              "number",
              "null"
            ]
          },
          "incluye": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CatalogoIncluye"
            }
          }
        },
        "required": [
          "code",
          "nombre",
          "precio_mensual",
          "max_reservas_activas",
          "cupo",
          "incluye"
        ]
      },
      "CatalogoIncluye": {
        "type": "object",
        "properties": {
          "servicio": {
            "description": "code del servicio.",
            "type": "string"
          },
          "por_mes": {
            "type": "number"
          },
          "ilimitado": {
            "type": "boolean"
          }
        },
        "required": [
          "servicio",
          "por_mes"
        ]
      },
      "ClienteOAuth": {
        "type": "object",
        "properties": {
          "client_id": {
            "type": "string"
          },
          "client_name": {
            "type": "string"
          },
          "redirect_uris": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "dominio": {
            "description": "Dominio de la dirección de regreso pedida (a donde irá el código), para mostrarlo en grande.",
            "type": "string"
          },
          "verificado": {
            "description": "El dominio está en la lista de asistentes conocidos (claude.ai, claude.com, chatgpt.com, openai.com).",
            "type": "boolean"
          }
        },
        "required": [
          "client_id",
          "client_name",
          "redirect_uris",
          "dominio",
          "verificado"
        ]
      },
      "SolicitudAutorizacion": {
        "type": "object",
        "properties": {
          "client_id": {
            "type": "string"
          },
          "redirect_uri": {
            "type": "string"
          },
          "state": {
            "type": "string"
          },
          "code_challenge": {
            "type": "string"
          },
          "code_challenge_method": {
            "type": "string",
            "enum": [
              "S256"
            ]
          },
          "scope": {
            "type": "string"
          },
          "resource": {
            "type": "string"
          }
        },
        "required": [
          "client_id",
          "redirect_uri",
          "code_challenge",
          "code_challenge_method",
          "scope",
          "resource"
        ]
      },
      "Error": {
        "description": "Rechazo del API: código estable (ver textos.errores en textos.es-MX.json) y, si aplica, los campos inválidos.",
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "campos": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "error"
        ],
        "additionalProperties": true
      }
    },
    "responses": {
      "Error": {
        "description": "Error",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    },
    "securitySchemes": {
      "oauth2": {
        "type": "oauth2",
        "description": "OAuth 2.1 con PKCE (S256) y registro dinámico de cliente (RFC 7591). Pide solo los alcances que necesitas.",
        "flows": {
          "authorizationCode": {
            "authorizationUrl": "https://app.olavital.com/oauth/autorizar",
            "tokenUrl": "https://app.olavital.com/api/oauth/token",
            "refreshUrl": "https://app.olavital.com/api/oauth/token",
            "scopes": {
              "ola.membresia": "Read the member's plan, services left this month, minimal profile and referrals.",
              "ola.citas": "See services, stylists and free slots; book and cancel the member's appointments.",
              "ola.pagos": "Pay an outstanding balance with the member's saved card. Never granted by default: request it explicitly; she confirms every payment.",
              "ola.admin": "Owners only: read the salon dashboard (schedule, sales, memberships) without health or tax data, and draft promotions.",
              "ola.admin.acciones": "Owners only: high-risk actions (reschedule, charge, cancel memberships, publish). Each action shows a preview and requires confirmation."
            }
          }
        }
      }
    }
  }
}