package com.cool.store.controller.webb;

import com.cool.store.context.CurrentUserHolder;
import com.cool.store.context.LoginUserInfo;
import com.cool.store.request.LineFollowLogRequest;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.LineFollowService;
import com.cool.store.vo.log.LineFollowLogVO;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author zhangchenbiao
 * @FileName: LineFollowController
 * @Description:
 * @date 2024-03-27 15:02
 */
@Api(tags = "跟进日志")
@RestController
@RequestMapping({"pc/follow"})
public class LineFollowController {

    @Resource
    private LineFollowService lineFollowService;

    @ApiOperation("跟进日志分页")
    @GetMapping("/page")
    public ResponseResult<PageInfo<LineFollowLogVO>> getFollowLogPage(Long lineId, Integer pageNum, Integer pageSize){
        return ResponseResult.success(lineFollowService.getFollowLogPage(lineId, pageNum, pageSize));
    }

    @ApiOperation("新增跟进日志")
    @PostMapping("/log/add")
    public ResponseResult<Long> addFollowLog(@RequestBody LineFollowLogRequest request){
        LoginUserInfo user = CurrentUserHolder.getUser();
        return ResponseResult.success(lineFollowService.addFollowLog(request, user.getUserId(), user.getName()));
    }

}
