package com.red.circle.console.adapter.app.approval;

import com.red.circle.console.app.dto.clienobject.approval.ApprovalDynamicReportedCO;
import com.red.circle.console.app.service.app.approval.ApprovalDynamicReportService;
import com.red.circle.framework.dto.PageResult;
import com.red.circle.framework.web.controller.BaseController;
import com.red.circle.other.inner.model.cmd.approval.ApprovalDynamicReportCmd;
import com.red.circle.other.inner.model.cmd.approval.ApprovalDynamicReportQryCmd;
import lombok.AllArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
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;

/**
 * 动态-投诉 前端控制器.
 *
 * @author pengshigang
 * @since 2022-4-18
 */
@AllArgsConstructor
@RestController
@RequestMapping("/dynamic/report")
public class ApprovalDynamicReportRestController extends BaseController {

  private final ApprovalDynamicReportService approvalDynamicReportService;

  /**
   * 分页
   */
  @GetMapping("/page")
  public PageResult<ApprovalDynamicReportedCO> pageData(ApprovalDynamicReportQryCmd query) {
    return approvalDynamicReportService.pageData(query);
  }

  /**
   * 处理投诉
   */
  @PostMapping
  public void report(@RequestBody @Validated ApprovalDynamicReportCmd cmd) {
    cmd.setApprovalUserId(getReqUserId());
    approvalDynamicReportService.report(cmd);
  }


}
