package com.qnfhq.modules.user.service;

import com.qnfhq.common.service.BaseService;
import com.qnfhq.common.utils.Result;
import com.qnfhq.modules.user.dto.*;
import com.qnfhq.modules.user.entity.AppUserEntity;
import jakarta.servlet.http.HttpServletRequest;

/**
 * 玩家用户表
 *
 * @author yelz 30262728@qq.com
 * @since 1.0.0 2025-11-11
 */
public interface AppUserService extends BaseService<AppUserEntity> {

    AppUserEntity getUserByEmail(String email);

    AppUserEntity getUserByMobile(String mobile,String zone);

    AppUserEntity getUserByUserId(Long userId);

    AppUserEntity getUserByActiveCode(String activeCode);


    /**
     * 初始化用户详情
     * @param user
     */
    void initAppUserDetail(AppUserEntity user);

    /**
     * 初始化用户资产
     * @param user
     */
    void initAppUserAsset(AppUserEntity user);
    /**
     * 注册
     * @param dto
     * @param request
     * @return
     */
    Result register(AppRegisterDTO dto, HttpServletRequest request);


    /**
     * 登陆
     * @param dto
     * @param request
     * @return
     */
    Result login(AppLoginDTO dto, HttpServletRequest request);

    /**
     * 邮箱发送验证码
     * @param codeType 类型：LOGIN 登录使用
     * @param email 邮箱
     * @return
     */
    public Result sendEmailCode(String codeType, String email);

    /**
     * 手机发送验证码
     * @param codeType 类型：LOGIN 登录使用
     * @param phone 手机号
     * @param zone 区号
     * @return
     */
    public Result sendMobileCode(String codeType,String phone,String zone);



    Result resetPwdByEmail(ResetPwdByEmailDTO codeDTO);
    Result resetPwdByPhone(ResetPwdByPhoneDTO codeDTO);


    Result checkCaptcha(CheckCaptchaDTO dto, HttpServletRequest request);

    Result checkPhoneCode(String codeType,String zone,String phone,String code);

    Result checkEmailCode(String codeType,String email,String code);
    Result resetPwdByEmail(String email,String pwd);
    Result resetPwdByPhone(String zone,String phone,String pwd);
}