syntax = "v1"

type (
	// Validating captcha request | 验证验证码请求
	ValidateCaptchaReq {
		// Captcha ID which store in redis | 图形验证码编号, 存在redis中
		//
		// Required: true
		// Max length: 32
		CaptchaId string `json:"captchaId"  validate:"len=32"`

		// The Captcha which users input | 用户输入的验证码
		//
		// Required: true
		// Max length: 4
		Captcha string `json:"captcha" validate:"len=4"`

		// Auto remove captcha | 自动删除被验证的验证码
		//
		// Required: false
		Clear bool `json:"clear,optional"`
	}
)


@server(
	group: captcha
	prefix: /api/captcha
)
service api {
	// Get Captcha | 获取验证码
	@handler getCaptcha
	get / returns (CaptchaInfo)

	// Validating captcha | 验证验证码正确性
	@handler validateCaptcha
	post /validate (ValidateCaptchaReq)
}