{
  "openapi": "3.1.0",
  "info": {
    "title": "AsturWebs API",
    "description": "Endpoints para la interacción programática con los servicios de AsturWebs.",
    "version": "1.0.0",
    "contact": {
      "name": "Pedro Luis Cuevas Villarrubia",
      "email": "pedro@asturwebs.es",
      "url": "https://asturwebs.es/contacto/"
    },
    "license": {
      "name": "MIT",
      "url": "https://opensource.org/licenses/MIT"
    }
  },
  "servers": [
    {
      "url": "https://asturwebs.es/api",
      "description": "Production"
    }
  ],
  "paths": {
    "/contacto": {
      "post": {
        "summary": "Enviar formulario de contacto",
        "description": "Envía un mensaje a Pedro Luis. Retorna confirmación y envía notificación por email.",
        "operationId": "sendContactForm",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "nombre": {
                    "type": "string",
                    "description": "Nombre del remitente."
                  },
                  "email": {
                    "type": "string",
                    "format": "email",
                    "description": "Email válido del remitente."
                  },
                  "mensaje": {
                    "type": "string",
                    "minLength": 10,
                    "description": "Contenido del mensaje."
                  }
                },
                "required": [
                  "nombre",
                  "email",
                  "mensaje"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Mensaje enviado correctamente.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Rate limit excedido (10 req/min por IP)."
          },
          "500": {
            "description": "Error del servidor."
          }
        }
      }
    },
    "/chat": {
      "post": {
        "summary": "Chat con BytIA",
        "description": "Asistente IA entrenado sobre los servicios de AsturWebs. Responde consultas y puede captar datos de contacto.",
        "operationId": "chatWithBytIA",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "message": {
                    "type": "string",
                    "description": "Mensaje del usuario."
                  }
                },
                "required": [
                  "message"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Respuesta del asistente.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "reply": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Rate limit excedido (10 req/min por IP)."
          }
        }
      }
    },
    "/health": {
      "get": {
        "summary": "Estado de la API",
        "description": "Verifica que los endpoints están operativos.",
        "operationId": "checkHealth",
        "responses": {
          "200": {
            "description": "API operativa.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "example": "ok"
                    },
                    "uptime": {
                      "type": "number"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/agents": {
      "get": {
        "summary": "Manifiesto del agente (JSON)",
        "description": "Retorna agents.txt en formato JSON estructurado.",
        "operationId": "getAgentsManifest",
        "responses": {
          "200": {
            "description": "Manifiesto del agente.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "agents-txt": {
                      "type": "string"
                    },
                    "updated": {
                      "type": "string"
                    },
                    "discovery": {
                      "type": "object"
                    },
                    "identity": {
                      "type": "object"
                    },
                    "services": {
                      "type": "array"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {},
    "x-rate-limit": {
      "description": "Todos los endpoints están limitados a 10 requests/minuto por IP. Sin autenticación requerida.",
      "requests": 10,
      "period": "minute",
      "key": "IP"
    }
  }
}