package com.red.circle.wallet.inner.endpoint.diamond.api;

import com.red.circle.framework.dto.PageResult;
import com.red.circle.framework.dto.ResultResponse;
import com.red.circle.wallet.inner.model.cmd.UserSalaryDiamondCmd;
import com.red.circle.wallet.inner.model.cmd.UserSalaryDiamondRunningWaterQryCmd;
import com.red.circle.wallet.inner.model.dto.SalaryDiamondBalanceDTO;
import com.red.circle.wallet.inner.model.dto.UserSalaryDiamondRunningWaterDTO;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;

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.RequestParam;

/**
 * 用户工资钻石流水
 *
 * @author zongpubin on 2024/3/14
 */
public interface SalaryDiamondRunningWaterClientApi {

  String API_PREFIX = "/salary/diamond/running/water/client";

  /**
   * 添加流水.
   */
  @PostMapping("/add")
  ResultResponse<Void> add(@RequestBody UserSalaryDiamondRunningWaterDTO salaryDiamondRunningWater);

  /**
   * 添加流水.
   */
  @PostMapping("/addBatch")
  ResultResponse<Void> addBatch(
      @RequestBody List<UserSalaryDiamondRunningWaterDTO> salaryDiamondRunningWaters);

  /**
   * 分页查询流水.
   */
  @PostMapping("/runningWaterPage")
  ResultResponse<PageResult<UserSalaryDiamondRunningWaterDTO>> runningWaterPage(
      @RequestBody UserSalaryDiamondRunningWaterQryCmd query);

  /**
   * 是否存在跟踪id.
   */
  @GetMapping("/existsTrackId")
  ResultResponse<Boolean> existsTrackId(@RequestParam("trackId") String trackId);

  /**
   * 是否存在跟踪id.
   */
  @GetMapping("/userTypeExistsTrackId")
  ResultResponse<Boolean> existsTrackId(
          @RequestParam("userId") Long userId,
          @RequestParam("event") String event,
          @RequestParam("trackId") String trackId);

  /**
   * 添加流水(异步).
   *
   * @param salaryDiamondRunningWater 单据
   * @return 余额
   */
  @PostMapping("/add/async")
  CompletableFuture<ResultResponse<Void>> addAsync(@RequestBody UserSalaryDiamondRunningWaterDTO salaryDiamondRunningWater);


  @GetMapping("/diamond/data")
  ResultResponse<Map<Integer, Long>> getDiamondData(@RequestParam("userId") Long userId,
                                                    @RequestParam("isMonth") Boolean isMonth);

  @PostMapping("/diamondByUserIds")
  ResultResponse<Map<Long, Long>> getDiamondByUserIds(@RequestBody List<Long> userIds);
}
