package com.yuchen.saas.park.service.controller.repair;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.yuchen.saas.park.api.dto.repair.*;
import com.yuchen.saas.park.api.vo.repair.SaasComplainSuggestVo;
import com.yuchen.saas.park.service.service.repair.ISaasComplainSuggestService;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nest.springwrap.core.mp.support.NestPage;
import org.nest.springwrap.core.tool.api.R;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 投诉建议表 前端控制器
 * </p>
 *
 * @author caiwq
 * @since 2024-04-26
 */
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/complainSuggest")
public class SaasComplainSuggestController {

    private final ISaasComplainSuggestService baseService;


    /**
     * 新增投诉建议
     * @param complainSuggestDto 投诉建议Dto
     * @return TRUE/FALSE
     */
    @PostMapping("/add")
    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "新增投诉建议", notes = "新增投诉建议")
    public R<Boolean> add(@RequestBody @Validated SaasComplainSuggestDto complainSuggestDto) {
        return R.data(baseService.add(complainSuggestDto));
    }

    /**
     * 处理投诉建议
     * @param handleDto 处理Dto
     * @return TRUE/FALSE
     */
    @PostMapping("/handle")
    @ApiOperationSupport(order = 2)
    @ApiOperation(value = "处理投诉建议", notes = "处理投诉建议")
    public R<Boolean> handle(@RequestBody @Validated SaasComplainSuggestHandleDto handleDto) {
        return R.data(baseService.handle(handleDto));
    }

    /**
     * 删除投诉建议
     * @param id 投诉建议ID
     * @return TRUE/FALSE
     */
    @DeleteMapping("/remove/{id}")
    @ApiOperationSupport(order = 3)
    @ApiOperation(value = "删除投诉建议", notes = "删除投诉建议")
    public R<Boolean> remove(@ApiParam(name = "id", value = "主键ID", required = true) @PathVariable("id") Long id) {
        return R.data(baseService.remove(id));
    }

    /**
     * 取消
     * @param cancleDto 取消Dto
     * @return TRUE/FALSE
     */
    @PostMapping("/cancle")
    @ApiOperationSupport(order = 5)
    @ApiOperation(value = "取消", notes = "取消")
    public R<Boolean> cancle(@RequestBody @Validated SaasComplainSuggestCancleDto cancleDto) {
        return R.data(baseService.cancle(cancleDto));
    }

    /**
     * 投诉建议评价
     * @param evaluateDto 评价Dto
     * @return TRUE/FALSE
     */
    @PostMapping("/evaluate")
    @ApiOperationSupport(order = 6)
    @ApiOperation(value = "投诉建议评价", notes = "投诉建议评价")
    public R<Boolean> evaluate(@RequestBody @Validated SaasComplainSuggestEvaluateDto evaluateDto) {
        return R.data(baseService.evaluate(evaluateDto));
    }

    /**
     * 投诉建议详情
     * @param id 投诉建议ID
     * @return 投诉建议详情Vo
     */
    @GetMapping("/getDetail/{id}")
    @ApiOperationSupport(order = 6)
    @ApiOperation(value = "投诉建议详情", notes = "投诉建议详情")
    public R<SaasComplainSuggestVo> getDetail(@ApiParam(name = "id", value = "主键ID", required = true) @PathVariable("id") Long id) {
        return R.data(baseService.getDetail(id));
    }

    /**
     * 投诉建议列表(分页)
     * @param queryDto 投诉建议列表查询参数
     * @return 投诉建议列表Vo
     */
    @PostMapping("/list")
    @ApiOperationSupport(order = 4)
    @ApiOperation(value = "投诉建议列表(分页)", notes = "投诉建议列表(分页)")
    public R<NestPage<SaasComplainSuggestVo>> list(@RequestBody SaasComplainSuggestQueryDto queryDto) {
        return R.data(baseService.list(queryDto));
    }

}
