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

import com.red.circle.framework.dto.PageResult;
import com.red.circle.framework.dto.ResultResponse;
import com.red.circle.other.inner.endpoint.user.user.api.UserConfessionRecordClientApi;
import com.red.circle.other.inner.model.cmd.user.UserConfessionRecordQryCmd;
import com.red.circle.other.inner.model.dto.user.UserConfessionDTO;
import com.red.circle.other.inner.model.dto.user.UserConfessionRecordDTO;
import com.red.circle.other.app.inner.service.user.user.UserConfessionRecordClientService;
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/30
 */
@Validated
@RestController
@RequestMapping(value = UserConfessionRecordClientApi.API_PREFIX, produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
public class UserConfessionRecordClientEndpoint implements UserConfessionRecordClientApi {

  private final UserConfessionRecordClientService userConfessionRecordClientService;

  @Override
  public ResultResponse<PageResult<UserConfessionRecordDTO>> pageListQuery(
      UserConfessionRecordQryCmd query) {
    return ResultResponse.success(userConfessionRecordClientService.pageListQuery(query));
  }

  @Override
  public ResultResponse<Void> auditUserConfession(UserConfessionDTO dto) {
    userConfessionRecordClientService.auditUserConfession(dto);
    return ResultResponse.success();
  }
}
