package com.ruoyi.ibs.task.controller;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.ibs.task.domain.dto.CustomFeedbackDTO;
import com.ruoyi.ibs.task.domain.dto.VisitFeedbackPrivateDTO;
import com.ruoyi.ibs.task.domain.dto.VisitFeedbackPublicDTO;
import com.ruoyi.ibs.task.service.VisitFeedbackService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Author 吴凯程
 * @Date 2025/6/19
 **/
@Api(tags = "走访反馈上传接口")
@RestController
@RequestMapping("/visit/feedback")
public class VisitFeedbackController {
    @Resource
    private VisitFeedbackService visitFeedbackService;

    @ApiOperation("获取产品列表")
    @GetMapping("/product")
    public AjaxResult getIntentionProductDict() {
        return AjaxResult.success(visitFeedbackService.getIntentionProductDict());
    }

    @ApiOperation("获取反馈")
    @GetMapping("/detail")
    public AjaxResult savePublicFeedback(@RequestParam String feedbackType, @RequestParam String feedbackId) {
        return AjaxResult.success(visitFeedbackService.getFeedback(feedbackType, feedbackId));
    }

    @ApiOperation("获取反馈")
    @GetMapping("/template")
    public AjaxResult getCustomFeedbackTemplate(@RequestParam String feedbackTemplateId) {
        return AjaxResult.success(visitFeedbackService.getCustomFeedbackTemplate(feedbackTemplateId));
    }

    @ApiOperation("保存自定义模板")
    @PostMapping("/custom")
    public AjaxResult saveCustomFeedback(@RequestBody CustomFeedbackDTO customFeedbackDTO) {
        return AjaxResult.success(visitFeedbackService.saveCustomFeedback(customFeedbackDTO));
    }

    @ApiOperation("保存私有模板")
    @PostMapping("/private")
    public AjaxResult savePrivateFeedback(@RequestBody VisitFeedbackPrivateDTO visitFeedbackPrivateDTO) {
        return AjaxResult.success(visitFeedbackService.savePrivateFeedback(visitFeedbackPrivateDTO));
    }

    @ApiOperation("保存公共模板")
    @PostMapping("/public")
    public AjaxResult savePublicFeedback(@RequestBody VisitFeedbackPublicDTO visitFeedbackPublicDTO) {
        return AjaxResult.success(visitFeedbackService.savePublicFeedback(visitFeedbackPublicDTO));
    }


}
