package com.example.demo.module.login;

import com.example.demo.common.RequestResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 控制器-游戏登陆
 */
@RestController
@RequestMapping("/gameLogin")
public class GameLoginController {
    @Autowired
    GameLoginService service;
    /**
     * 普通登录
     */
    @PostMapping("/loginNormal")
    public RequestResult loginNormal(String username, String password) {
        return service.login(username, password);
    }

    /**
     * 用户注册
     */
    @PostMapping("/register")
    public RequestResult register(String username, String password) {
        return service.register(username, password);
    }

    /**
     * 用户注册后，完善用户信息的提交处理
     */
    @PostMapping("/completeUserInfo")
    public RequestResult completeUserInfo(
            String username, String password, String nickname, int gender, String birthday,
            String countryCode, String stateCode, String cityCode) {
        return service.completeUserInfo(username, password, nickname, gender, birthday, countryCode, stateCode, cityCode);
    }

    @PostMapping("/loginByPhone")
    public RequestResult loginByPhone(String phone) {
        return service.loginByPhone(phone);
    }
}
