package com.red.circle.console.adapter.app.user;


import com.red.circle.console.app.service.app.user.UserInviteUserRegisterService;
import com.red.circle.framework.dto.PageResult;
import com.red.circle.framework.web.controller.BaseController;
import com.red.circle.other.inner.endpoint.user.user.api.UserInviteUserClientApi;
import com.red.circle.other.inner.model.cmd.user.InviteUserQryCmd;
import com.red.circle.other.inner.model.dto.user.PageInviteUserRegisterDTO;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 用户邀请用户注册信息表 前端控制器
 * </p>
 *
 * @author houyong
 * @since 2020-05-21
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/user-invite-register")
public class UserInviteUserRegisterRestController extends BaseController {

  private final UserInviteUserRegisterService userInviteUserRegisterService;
  private final UserInviteUserClientApi userInviteUserClientApi;

//  @GetMapping("/page")
  public PageResult<PageInviteUserRegisterDTO> getInviteUser(InviteUserQryCmd query) {
    return userInviteUserRegisterService.pageQuery(query);
  }

  /**
   * 分页查询用户邀请记录（新数据源）
   */
  @GetMapping("/page")
  public PageResult<PageInviteUserRegisterDTO> getInviteUserV2(InviteUserQryCmd query) {
    return userInviteUserClientApi.pageQuery(query).getBody();
  }

}
