package com.ruoyi.xq.controller.app;

import cn.dev33.satoken.annotation.SaIgnore;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.xq.domain.ReportCate;
import com.ruoyi.xq.dto.app.report.ReportPushReq;
import com.ruoyi.xq.dto.app.setting.AgreementDTO;
import com.ruoyi.xq.service.ReportCateService;
import com.ruoyi.xq.service.ReportService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/report")
@Tag(name = "举报相关接口")
public class ReportAppController {
    @Autowired
    private ReportCateService reportCateService;
    @Autowired
    private ReportService reportService;

    @GetMapping("/cate/list")
    @Operation(summary = "获取举报类型")
    public R<List<ReportCate>> cateList() {
        List<ReportCate> list = reportCateService.list();
        return R.ok(list);
    }

    @PostMapping("/push")
    @Operation(summary = "举报")
    @Log(title = "举报", businessType = BusinessType.OTHER, isSaveDb = true)
    public R<AgreementDTO> push(@RequestBody ReportPushReq reportPushReq) {
        reportService.push(reportPushReq);
        return R.ok();
    }
}
