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

import com.red.circle.framework.dto.PageResult;
import com.red.circle.framework.dto.ResultResponse;
import com.red.circle.other.app.inner.service.live.RoomContributionBalanceClientService;
import com.red.circle.other.inner.endpoint.live.api.RoomContributionBalanceClientApi;
import com.red.circle.other.inner.model.cmd.live.RoomContributionBalancePageQryCmd;
import com.red.circle.other.inner.model.dto.live.RoomContributionBalanceDTO;
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/7/24
 */
@Validated
@RestController
@RequestMapping(value = RoomContributionBalanceClientApi.API_PREFIX, produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
public class RoomContributionBalanceClientEndpoint implements RoomContributionBalanceClientApi {

  private final RoomContributionBalanceClientService roomContributionBalanceClientService;

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

  @Override
  public ResultResponse<PageResult<RoomContributionBalanceDTO>> pageRoomContributionOps(
      RoomContributionBalancePageQryCmd qryCmd) {
    return ResultResponse.success(
        roomContributionBalanceClientService.pageRoomContributionOps(qryCmd)
    );
  }

}
