package v1

import (
	"github.com/gogf/gf/v2/frame/g"
)

type TotpStatusGetReq struct {
	g.Meta `path:"/user/totp/status" tags:"TOTP二步验证" method:"get" summary:"确认当前用户是否开启totp"`
}

type TotpStatusGetRes struct {
	Status    bool   `json:"status"`
	Image     string `json:"image"`
	OtpSecret string `json:"otpSecret"`
	OtpKey    string `json:"otpKey"`
}

// TotpSetReq 设置二步验证
type TotpSetReq struct {
	g.Meta    `path:"/user/totp/set" tags:"TOTP二步验证" method:"post" summary:"设置二步验证"`
	Code      string `p:"code" v:"required#验证码不能为空"`
	OtpKey    string `p:"otpKey" v:"required#otpKey不能为空"`
	OtpSecret string `p:"otpSecret" v:"required#otpSecret不能为空"`
	Password  string `p:"password" v:"required#密码不能为空"`
}

type TotpSetRes struct{}

// TotpImageGetReq 查看两步验证图像
type TotpImageGetReq struct {
	g.Meta `path:"/user/totp/image" tags:"TOTP二步验证" method:"get" summary:"查看两步验证图像"`
	Code   string `p:"code" v:"required#验证码不能为空"`
}

type TotpImageGetRes struct {
	Image string `json:"image"`
}

// TotpResetReq 重置两步验证
type TotpResetReq struct {
	g.Meta `path:"/user/totp/reset" tags:"TOTP二步验证" method:"post" summary:"重置两步验证"`
	Code   string `p:"code" v:"required#验证码不能为空"`
}

type TotpResetRes struct {
	Image string `json:"image"`
}
