package com.mcwl.web.controller.communityCenter;

import com.mcwl.common.core.domain.R;
import com.mcwl.common.core.page.PageDomain;
import com.mcwl.common.core.page.TableDataInfo;
import com.mcwl.communityCenter.domain.dto.PublishReportRes;
import com.mcwl.communityCenter.service.PublishReportService;
import com.mcwl.communityCenter.service.PublishService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * 发布举报
 */
@Api(tags = "发布举报")
@RestController
@RequestMapping("publishReport")
@RequiredArgsConstructor
public class PublishReportController {

    private final PublishService publishService;

    private final PublishReportService publishReportService;


    /**
     * 举报
     */
    @ApiOperation(value = "举报")
    @PostMapping("report")
    public R<Object> reportPublish(@RequestBody @Valid PublishReportRes publishReportRes) {
        publishService.reportPublish(publishReportRes);
        return R.ok();
    }

    /**
     * 获取举报列表
     */
    @ApiOperation(value = "获取举报列表")
    @PostMapping("list")
    public TableDataInfo getReportList(@RequestBody @Valid PageDomain pageDomain) {
        return publishReportService.getReportList(pageDomain);
    }



}
