package handler

import (
	"net/http"

	"github.com/zeromicro/go-zero/rest/httpx"
	"jyBXBuyer/api/internal/logic"
	"jyBXBuyer/api/internal/svc"
	"jyBXBuyer/api/internal/types"
)

func buyerSupplyInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		var req types.BuyerSupplyInfoReq
		if err := httpx.Parse(r, &req); err != nil {
			httpx.Error(w, err)
			return
		}

		l := logic.NewBuyerSupplyInfoLogic(r.Context(), svcCtx)
		resp, err := l.BuyerSupplyInfo(&req)
		if err != nil {
			httpx.Error(w, err)
		} else {
			httpx.OkJson(w, resp)
		}
	}
}
