package captcha

import (
	"net/http"

	"git.noahlan.cn/noahlan/ntool-biz/zero/statusz"

	"git.noahlan.cn/n-admin/n-admin-server/api/internal/logic/captcha"
	"git.noahlan.cn/n-admin/n-admin-server/api/internal/svc"
)

// swagger:route get /api/captcha captcha GetCaptcha
//
// Get Captcha | 获取验证码
//
// Get Captcha | 获取验证码
//
// Responses:
//  200: CaptchaInfo

func GetCaptchaHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		const transErr = true

		l := captcha.NewGetCaptchaLogic(r, r.Context(), svcCtx)
		resp, err := l.GetCaptcha()

		statusz.ResponseHandler(r, w, transErr, resp, err)

	}
}
