package com.red.circle.order.inner.endpoint;

import com.red.circle.framework.dto.ResultResponse;
import com.red.circle.order.inner.endpoint.api.TotalRechargeClientApi;
import com.red.circle.order.inner.model.dto.UserTotalRechargeDTO;
import com.red.circle.order.inner.service.UserTotalRechargeClientService;
import java.util.List;
import java.util.Map;
import java.util.Set;
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 2024/1/23
 */
@Validated
@RestController
@RequestMapping(value = TotalRechargeClientApi.API_PREFIX, produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
public class TotalRechargeClientEndpoint implements TotalRechargeClientApi {

  private final UserTotalRechargeClientService userTotalRechargeClientService;

  @Override
  public ResultResponse<Map<Long, List<UserTotalRechargeDTO>>> mapGroup(Set<Long> userIds) {
    return ResultResponse.success(
        userTotalRechargeClientService.mapGroup(userIds)
    );
  }
}
