package admin_order

import (
	"net/http"

	"github.com/zeromicro/go-zero/rest/httpx"
	"hm-server/app/main/api/internal/logic/admin_order"
	"hm-server/app/main/api/internal/svc"
	"hm-server/app/main/api/internal/types"
)

// 重新执行代理处理
func AdminRetryAgentProcessHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		var req types.AdminRetryAgentProcessReq
		if err := httpx.Parse(r, &req); err != nil {
			httpx.ErrorCtx(r.Context(), w, err)
			return
		}

		l := admin_order.NewAdminRetryAgentProcessLogic(r.Context(), svcCtx)
		resp, err := l.AdminRetryAgentProcess(&req)
		if err != nil {
			httpx.ErrorCtx(r.Context(), w, err)
		} else {
			httpx.OkJsonCtx(r.Context(), w, resp)
		}
	}
}
