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

import com.red.circle.framework.dto.PageResult;
import com.red.circle.framework.dto.ResultResponse;
import com.red.circle.other.app.inner.service.user.user.UserInviteUserClientService;
import com.red.circle.other.inner.endpoint.user.user.api.UserInviteUserClientApi;
import com.red.circle.other.inner.model.cmd.user.InviteStatisticsQryCmd;
import com.red.circle.other.inner.model.cmd.user.InviteUserQryCmd;
import com.red.circle.other.inner.model.dto.user.PageInviteUserRegisterDTO;
import com.red.circle.other.inner.model.dto.user.UserInviteUserCountDTO;
import java.util.Map;
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 xiongcheng on 2024/3/8
 */
@Validated
@RestController
@RequestMapping(value = UserInviteUserClientApi.API_PREFIX, produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
public class UserInviteUserClientEndpoint implements UserInviteUserClientApi {

  private final UserInviteUserClientService userInviteUserClientService;

  @Override
  public ResultResponse<Map<Long, UserInviteUserCountDTO>> mapInviteStatisticsByUserIds(
      InviteStatisticsQryCmd qryCmd) {
    return ResultResponse.success(userInviteUserClientService.mapInviteStatisticsByUserIds(qryCmd));
  }

  @Override
  public ResultResponse<PageResult<PageInviteUserRegisterDTO>> pageQuery(InviteUserQryCmd query) {
    return ResultResponse.success(userInviteUserClientService.pageQuery(query));
  }
}
