package io.renren.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.renren.common.utils.Result;
import io.renren.common.vo.account.AcctInfoQueryResp;
import io.renren.common.vo.user.UserInfoQueryResp;
import io.renren.service.AccountService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping("/api/account")
@Api(tags="账户管理")
public class AccountController {
	
	@Autowired
	private AccountService accountService;

    @GetMapping("/openAccount")
    @ApiOperation("页面开户")
    public Result<String> openAccount(@RequestParam("userId") String userId) throws Exception{
    	return new Result<String>().ok(accountService.openAccount(userId));
    }

    @GetMapping("/queryAccount")
    @ApiOperation("账户信息查询")
    public Result<AcctInfoQueryResp> queryAccount(@RequestParam("userId") String userId) throws Exception{
    	return new Result<AcctInfoQueryResp>().ok(accountService.queryAccount(userId));
    }
    
    @GetMapping("/queryUserinfo")
    @ApiOperation("用户信息查询")
    public Result<UserInfoQueryResp> queryUserinfo(@RequestParam("userId") String userId) throws Exception{
    	return new Result<UserInfoQueryResp>().ok(accountService.queryUserinfo(userId));
    }
    
    
}