syntax = "v1"

info (
	title:   "聚玩邮件服务"
	desc:    "处理邮件验证码发送与密码找回"
	author:  "Asadz"
	date:    "2024-06-19"
	version: "1.0"
)

type (
	EmptyResp  {}
	ForgotPasswordReq {
		Email string `json:"email"`
	}
	SendVerificationCodeReq {
		Email string `json:"email" binding:"required,email"`
		Scene string `json:"scene" binding:"required,oneof=register login reset_password bind_email"`
	}
	SendVerificationCodeResp {
		RequestId   string `json:"requestId"`
		ExpireInSec int64  `json:"expireInSec"`
		Message     string `json:"message"`
	}
)

@server (
	group:      email
	prefix:     /api/v1/email
	middleware: Logger
)
service email-api {
	@doc (
		summary:     "发送邮箱验证码"
		description: "向用户邮箱发送验证码，支持注册、登录、重置密码、绑定邮箱等场景"
	)
	@handler SendVerificationCode
	post /verification-code/send (SendVerificationCodeReq) returns (SendVerificationCodeResp)
}

@server (
	group:  email
	prefix: /api/v1/auth
)
service email-api {
	@doc "忘记密码-发送验证码"
	@handler ForgotPassword
	post /forgot-password/send (ForgotPasswordReq) returns (EmptyResp)
}

