// Code scaffolded by goctl. Safe to edit.
// goctl 1.10.1

package persona

import (
	"net/http"

	"github.com/zeromicro/go-zero/rest/httpx"
	"haixun-backend/internal/logic/persona"
	"haixun-backend/internal/response"
	"haixun-backend/internal/svc"
	"haixun-backend/internal/types"
)

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

		l := persona.NewListTopicCandidatesLogic(r.Context(), svcCtx)
		data, err := l.ListTopicCandidates(&req)
		response.Write(r.Context(), w, data, err)
	}
}
