{"openapi":"3.0.0","info":{"version":"v1","title":"API Manejo de OTP","description":"Servicio para generar y validar OTP vía SMS o email"},"servers":[{"description":"SwaggerHub API Auto Mocking","url":"https://virtserver.swaggerhub.com/tss-5a5/otp-mock-api/v1"}],"paths":{"/otp/generar":{"post":{"summary":"Generar OTP","operationId":"generarOtp","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["idUsuario","via"],"properties":{"idUsuario":{"type":"string","example":"123"},"via":{"type":"string","enum":["sms","email"],"example":"sms"}}}}}},"responses":{"200":{"description":"OTP generado correctamente","content":{"application/json":{"schema":{"type":"object","properties":{"codigo":{"type":"string","example":"123456"}}}}}},"400":{"description":"Error en la solicitud","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/otp/validar":{"patch":{"summary":"Validar OTP","operationId":"validarOtp","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["idUsuario","codigo"],"properties":{"idUsuario":{"type":"string","example":"123"},"codigo":{"type":"string","example":"123456"}}}}}},"responses":{"200":{"description":"OTP válido","content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string","example":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."}}}}}},"400":{"description":"OTP inválido o error de validación","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Error de autenticación OTP","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"schemas":{"ErrorCode":{"type":"string","enum":["OTP_INVALID","OTP_EXPIRED","OTP_ALREADY_USED","INVALID_REQUEST","USER_NOT_FOUND"]},"ErrorResponse":{"type":"object","properties":{"code":{"$ref":"#/components/schemas/ErrorCode"},"message":{"type":"string","example":"El código OTP es inválido o ha expirado"}}}}}}