package com.mcwl.web.controller.resource;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mcwl.common.core.domain.R;
import com.mcwl.resource.domain.Report;
import com.mcwl.resource.domain.vo.PageVo;
import com.mcwl.resource.service.ReportService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 举报功能
 * @author DaiZibo
 * @date 2025/1/18
 * @apiNote
 */

@Api(tags = "举报")
@RequestMapping("/report")
@RestController
public class ReportController {

    @Autowired
    private ReportService reportService;

    /**
     * 新增举报内容
     * @param report
     * @return
     */
    @ApiOperation(value = "新增举报内容")
    @PostMapping("/addReport")
    public R<Object> addReport(@RequestBody Report report){

        reportService.addReport(report);
        return R.ok();
    }



    /**
     * 查询举报列表
     * @param pageVo
     * @return
     */
    @ApiOperation(value = "查询举报列表")
    @PostMapping("/selectReport")
    public R<Page<Report>> selectReport(@RequestBody PageVo pageVo){


        return reportService.selectReport(pageVo);
    }

    /**
     * 删除举报
     * @param id
     * @return
     */
    @ApiOperation(value = "删除举报")
    @GetMapping("/deleteReport")
    public R<Object> deleteReport(@RequestParam Long id){

        reportService.deleteReport(id);
        return R.ok();
    }

    /**
     * 修改举报状态
     * @param productId
     * @param type
     * @param status
     * @param text
     * @return
     */
    @ApiOperation(value = "修改状态")
    @GetMapping("/updateStatus")
    public R<Object> updateStatus(@RequestParam Long productId,Integer type,Integer status,String text){

        reportService.updateStatus(productId, type,status,text);
        return R.ok();
    }

}
