package xiaoice

import (
	"net/http"

	"github.com/zeromicro/go-zero/rest/httpx"

	"wechat-api/internal/logic/xiaoice"
	"wechat-api/internal/svc"
)

// swagger:route post /api/xiaoice/signature xiaoice SignatureGen
//
// get xiaoice signature | 获取小冰签名
//
// get xiaoice signature | 获取小冰签名
//
// Responses:
//  200: SignatureResp

func SignatureGenHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		l := xiaoice.NewSignatureGenLogic(r.Context(), svcCtx)
		resp, err := l.SignatureGen()
		if err != nil {
			httpx.ErrorCtx(r.Context(), w, err)
		} else {
			httpx.OkJsonCtx(r.Context(), w, resp)
		}
	}
}
