// Code generated by goctl. DO NOT EDIT.
// goctl 1.10.1

package handler

import (
	"net/http"

	community "juwan-backend/app/community/api/internal/handler/community"
	"juwan-backend/app/community/api/internal/svc"

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

func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
	server.AddRoutes(
		[]rest.Route{
			{
				// 获取帖子列表
				Method:  http.MethodGet,
				Path:    "/posts",
				Handler: community.ListPostsHandler(serverCtx),
			},
			{
				// 获取帖子详情
				Method:  http.MethodGet,
				Path:    "/posts/:id",
				Handler: community.GetPostHandler(serverCtx),
			},
			{
				// 获取帖子评论
				Method:  http.MethodGet,
				Path:    "/posts/:id/comments",
				Handler: community.ListCommentsHandler(serverCtx),
			},
			{
				// 获取用户帖子
				Method:  http.MethodGet,
				Path:    "/users/:id/posts",
				Handler: community.ListUserPostsHandler(serverCtx),
			},
		},
		rest.WithPrefix("/api/v1"),
	)

	server.AddRoutes(
		[]rest.Route{
			{
				// 点赞评论
				Method:  http.MethodPost,
				Path:    "/comments/:id/like",
				Handler: community.LikeCommentHandler(serverCtx),
			},
			{
				// 取消点赞评论
				Method:  http.MethodDelete,
				Path:    "/comments/:id/like",
				Handler: community.UnlikeCommentHandler(serverCtx),
			},
			{
				// 发布帖子
				Method:  http.MethodPost,
				Path:    "/posts",
				Handler: community.CreatePostHandler(serverCtx),
			},
			{
				// 发表评论
				Method:  http.MethodPost,
				Path:    "/posts/:id/comments",
				Handler: community.CreateCommentHandler(serverCtx),
			},
			{
				// 点赞帖子
				Method:  http.MethodPost,
				Path:    "/posts/:id/like",
				Handler: community.LikePostHandler(serverCtx),
			},
			{
				// 取消点赞帖子
				Method:  http.MethodDelete,
				Path:    "/posts/:id/like",
				Handler: community.UnlikePostHandler(serverCtx),
			},
			{
				// 置顶帖子
				Method:  http.MethodPost,
				Path:    "/posts/:id/pin",
				Handler: community.PinPostHandler(serverCtx),
			},
			{
				// 取消置顶
				Method:  http.MethodDelete,
				Path:    "/posts/:id/pin",
				Handler: community.UnpinPostHandler(serverCtx),
			},
		},
		rest.WithPrefix("/api/v1"),
	)
}
