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

import com.red.circle.framework.dto.ResultResponse;
import com.red.circle.wallet.inner.model.cmd.UserBankBalanceDecrCmd;
import com.red.circle.wallet.inner.model.cmd.UserBankBalanceIncrCmd;
import com.red.circle.wallet.inner.model.cmd.UserBankBalanceQryCmd;
import com.red.circle.wallet.inner.model.dto.BankBalanceDTO;
import com.red.circle.wallet.inner.model.dto.UserBankBalanceDTO;
import java.util.List;
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 pengliang on 2023/9/22
 */
public interface UserBankBalanceClientApi {

  String API_PREFIX = "/user-bank-balance/client";


  /**
   * 是否存在账户.
   *
   * @return true 存在.
   */
  @GetMapping("/exists")
  ResultResponse<Boolean> exists(@RequestParam("userId") Long userId);

  /**
   * 累计余额.
   *
   * @return 是否操作成功
   */
  @PostMapping("/incr")
  ResultResponse<Boolean> incr(@RequestBody @Validated UserBankBalanceIncrCmd cmd);

  /**
   * 类型消费累计.
   */
  @PostMapping("/decr")
  ResultResponse<BankBalanceDTO> decr(@RequestBody @Validated UserBankBalanceDecrCmd cmd);

  /**
   * 获取用户余额.
   */
  @GetMapping("/getBalance")
  ResultResponse<BankBalanceDTO> getBalance(@RequestParam("userId") Long userId);
  /**
   * 获取用户累计充值.
   */
  @GetMapping("/getTotalBalance")
  ResultResponse<Long> getTotalBalance(@RequestParam("userId") Long userId);

  /**
   * 查看用户银行卡账户.
   */
  @PostMapping("/listBalance")
  ResultResponse<List<UserBankBalanceDTO>> listBalance(@RequestBody UserBankBalanceQryCmd query);
}
