package com.red.circle.other.app.inner.endpoint.approval;

import com.red.circle.framework.dto.PageResult;
import com.red.circle.framework.dto.ResultResponse;
import com.red.circle.other.app.inner.service.approval.ApprovalDynamicReportClientService;
import com.red.circle.other.inner.endpoint.dynamic.api.ApprovalDynamicReportClientApi;
import com.red.circle.other.inner.model.cmd.approval.ApprovalDynamicReportCmd;
import com.red.circle.other.inner.model.cmd.approval.ApprovalDynamicReportQryCmd;
import com.red.circle.other.inner.model.dto.approval.ApprovalDynamicReportedDTO;
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 动态投诉
 *
 * @author zongpubin on 2024/1/20
 */
@Validated
@RestController
@RequestMapping(value = ApprovalDynamicReportClientApi.API_PREFIX, produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
public class ApprovalDynamicReportClientEndpoint implements ApprovalDynamicReportClientApi {

  private final ApprovalDynamicReportClientService approvalDynamicReportClientService;

  @Override
  public ResultResponse<PageResult<ApprovalDynamicReportedDTO>> pageData(
      ApprovalDynamicReportQryCmd query) {
    return ResultResponse.success(approvalDynamicReportClientService.pageData(query));
  }

  @Override
  public ResultResponse<Void> report(ApprovalDynamicReportCmd cmd) {
    approvalDynamicReportClientService.report(cmd);
    return ResultResponse.success();
  }
}
