package com.red.circle.wallet.inner.endpoint.bank;

import com.red.circle.framework.dto.ResultResponse;
import com.red.circle.wallet.inner.endpoint.bank.api.UserBankRunningWaterClientApi;
import com.red.circle.wallet.inner.model.cmd.UserBankApprovalMoneyApplyCmd;
import com.red.circle.wallet.inner.model.cmd.UserBankRunningWaterQryCmd;
import com.red.circle.wallet.inner.model.cmd.UserBankWithdrawGoldApplyQryCmd;
import com.red.circle.wallet.inner.model.cmd.UserBankWithdrawMoneyApplyQryCmd;
import com.red.circle.wallet.inner.model.dto.UserBankRunningWaterDTO;
import com.red.circle.wallet.inner.model.dto.UserBankWithdrawGoldApplyDTO;
import com.red.circle.wallet.inner.model.dto.UserBankWithdrawMoneyApplyDTO;
import com.red.circle.wallet.inner.service.bank.UserBankRunningWaterClientService;
import java.util.List;
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 pengliang on 2023/10/13
 */
@Validated
@RestController
@RequestMapping(value = UserBankRunningWaterClientApi.API_PREFIX, produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
public class UserBankRunningWaterClientEndpoint implements UserBankRunningWaterClientApi {

  private final UserBankRunningWaterClientService userBankRunningWaterClientService;

  @Override
  public ResultResponse<Boolean> existsTrackId(String trackId) {
    return ResultResponse.success(userBankRunningWaterClientService.existsTrackId(trackId));
  }

  @Override
  public ResultResponse<Boolean> existsTrackId(Long userId, String event, String trackId) {
    return ResultResponse.success(
        userBankRunningWaterClientService.existsTrackId(userId, event, trackId));
  }

  @Override
  public ResultResponse<Void> add(UserBankRunningWaterDTO runningWater) {
    userBankRunningWaterClientService.add(runningWater);
    return ResultResponse.success();
  }

  @Override
  public ResultResponse<Void> addBatch(List<UserBankRunningWaterDTO> runningWaters) {
    userBankRunningWaterClientService.addBatch(runningWaters);
    return ResultResponse.success();
  }


  @Override
  public ResultResponse<List<UserBankRunningWaterDTO>> pageRunningWater(
      UserBankRunningWaterQryCmd query) {
    return ResultResponse.success(userBankRunningWaterClientService.pageRunningWater(query));
  }

  @Override
  public ResultResponse<String> calculateTotal(UserBankRunningWaterQryCmd query) {
    return ResultResponse.success(userBankRunningWaterClientService.calculateTotal(query));
  }

  @Override
  public ResultResponse<List<UserBankWithdrawGoldApplyDTO>> pageBankWithdrawGoldApply(
      UserBankWithdrawGoldApplyQryCmd query) {
    return ResultResponse.success(
        userBankRunningWaterClientService.pageBankWithdrawGoldApply(query));
  }


  @Override
  public ResultResponse<List<UserBankWithdrawMoneyApplyDTO>> listBankWithdrawMoneyApply(
      UserBankWithdrawMoneyApplyQryCmd query) {
    return ResultResponse.success(
        userBankRunningWaterClientService.listBankWithdrawMoneyApply(query));
  }


  @Override
  public ResultResponse<UserBankWithdrawMoneyApplyDTO> getWithdrawMoneyApplyById(Long id) {
    return ResultResponse.success(userBankRunningWaterClientService.getWithdrawMoneyApplyById(id));
  }


  @Override
  public ResultResponse<Void> approvalMoneyApply(UserBankApprovalMoneyApplyCmd apply) {
    userBankRunningWaterClientService.approvalMoneyApply(apply);
    return ResultResponse.success();
  }

  @Override
  public ResultResponse<List<UserBankRunningWaterDTO>> getMonthSalaryRunningWater(List<Long> userIds, String event, String month) {
    return ResultResponse.success(userBankRunningWaterClientService.getMonthSalaryRunningWater(userIds, event, month));
  }

}
