package avatar

import (
	"net/http"

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

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

// swagger:route post /api/avatar/signature avatar GetSignatureResponse
//
// get avatar configuration | 阿里云oss服务签名
//
// get avatar configuration | 阿里云oss服务签名
//
// Responses:
//  200: AvatarSignatureResp

func GetSignatureResponseHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		l := avatar.NewGetSignatureResponseLogic(r.Context(), svcCtx)
		resp, err := l.GetSignatureResponse()
		if err != nil {
			httpx.ErrorCtx(r.Context(), w, err)
		} else {
			httpx.OkJsonCtx(r.Context(), w, resp)
		}
	}
}
