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

import com.red.circle.framework.dto.ResultResponse;
import com.red.circle.wallet.inner.endpoint.diamond.api.DiamondBalanceClientApi;
import com.red.circle.wallet.inner.service.diamond.DiamondBalanceClientService;
import java.math.BigDecimal;
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/12/27
 */
@Validated
@RestController
@RequestMapping(value = DiamondBalanceClientApi.API_PREFIX, produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
public class DiamondBalanceClientEndpoint implements DiamondBalanceClientApi {

  private final DiamondBalanceClientService diamondBalanceClientService;

  @Override
  public ResultResponse<BigDecimal> getAvailableBalance(Long userId) {
    return ResultResponse.success(diamondBalanceClientService.getAvailableBalance(userId));
  }


}
