package ownposts

import (
	"net/http"

	"apps/backend/internal/logic/ownposts"
	"apps/backend/internal/response"
	"apps/backend/internal/svc"
	"apps/backend/internal/types"

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

func OwnPostLoadRepliesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		var req types.OwnPostLoadRepliesReq
		if err := httpx.Parse(r, &req); err != nil {
			response.Write(r.Context(), w, nil, response.WrapRequestError(err))
			return
		}

		l := ownposts.NewOwnPostLoadRepliesLogic(r.Context(), svcCtx)
		data, err := l.OwnPostLoadReplies(&req)
		response.Write(r.Context(), w, data, err)
	}
}
