package jnpf.cultivate.v2.controller.app.gained;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import jnpf.base.ActionResult;
import jnpf.base.vo.PageListVO;
import jnpf.cultivate.v2.service.V2CourseGainedCommentService;
import jnpf.model.cultivate.CultivatePage;
import jnpf.model.cultivate.v2.gained.req.V2AppCommentPageListReq;
import jnpf.model.cultivate.v2.gained.vo.V2AppCourseGainedCommentVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * app岗位学习课程-心得评论模块
 */
@RestController
@RequestMapping("/v2/app/course_gained_comment")
public class V2CourseGainedCommentController {

    @Autowired
    private V2CourseGainedCommentService ftbCourseGainedCommentService;


    /**
     * 一级评论列表
     *
     * @param req
     * @return
     */
    @Operation(summary = "获取心得评论获取列表")
    @GetMapping("/list")
    public ActionResult<PageListVO<V2AppCourseGainedCommentVO>> appList(V2AppCommentPageListReq req) {
        return ActionResult.success(CultivatePage.coverPageList(ftbCourseGainedCommentService.getList(req)));
    }

    /**
     * 查看对应的心得评论回复
     *
     * @param firstCommentId 一级评论id
     * @return
     */
    @Operation(summary = "查看对应的心得评论回复（移动端）")
    @GetMapping("/listReply/{firstCommentId}")
    public ActionResult<List<V2AppCourseGainedCommentVO>> listReply(@PathVariable("firstCommentId") String firstCommentId) {
        return ActionResult.success(ftbCourseGainedCommentService.listReply(firstCommentId));
    }


}