package com.buy507.mall.portal.service;

import java.util.List;
import java.util.Map;

import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestParam;

import com.buy507.mall.common.api.CommonResult;
import com.buy507.mall.model.UmsMember;
import com.buy507.mall.portal.domain.AccountDetailResult;
import com.buy507.mall.portal.domain.FirstMemberInfoParam;
import com.buy507.mall.portal.domain.MemberInfoResult;
import com.buy507.mall.portal.domain.MemberTransferParam;
import com.buy507.mall.portal.domain.MemberTransferResult;
import com.buy507.mall.portal.domain.MemberWithdrawApplyResult;
import com.buy507.mall.portal.domain.TeamMemberResult;
import com.buy507.mall.portal.domain.WeChatLogin;
import com.buy507.mall.portal.domain.WithdrawApplyParam;

/**
 * 会员管理Service
 */
public interface UmsMemberService {
    /**
     * 根据用户名获取会员
     */
    UmsMember getByUsername(String username);

    /**
     * 根据会员编号获取会员
     */
    UmsMember getById(Long id);

    /**
     * 用户注册
     */
    @Transactional
    CommonResult register(String telephone, String password, String authCode);
    
    /**
     * 登录功能
     * @param telephone 手机号
     * @param password 密码
     * @return 生成的JWT的token
     */
    Map<String, String>  login(String telephone,String password);
    
    /**
     * 微信登录
     * @param weChatLogin
     * @return
     */
    Map<String, String> wechatLogin(WeChatLogin weChatLogin);

    /**
     * 生成验证码
     */
    CommonResult generateAuthCode(String telephone);

    /**
     * 修改密码
     */
    @Transactional
    CommonResult updatePassword(String telephone, String password, String authCode);

    /**
     * 获取当前登录会员
     */
    UmsMember getCurrentMember();

    /**
     * 根据会员id修改会员积分
     */
    void updateIntegration(Long id,Integer integration);
    
    MemberInfoResult getMemberInfo();
    /**
     * 修改用户昵称
     */
    CommonResult updateMemberNickname(String nickname);
    
    /**
     * 修改用户性别
     */
    CommonResult updateMemberGender(Integer gender);
    
    /**
     * 修改用户头像
     * 
     */
    CommonResult updateMemberIcon(String icon);
    
    /**
     * 修改会员手机号
     * @param newPhone
     * @param authCode
     * @return
     */
    CommonResult updateMemberPhone(String newPhone, String authCode);
    
    /**
     * 修改真实姓名
     * @param realName
     * @return
     */
    CommonResult<String> updateRealName(String realName);
    
    /**
     * 修改联系地址
     * @param realName
     * @return
     */
    CommonResult<String> updateAddress(String address);
    
    CommonResult addInviter(Long memberId);
    
    /**
     * 查询账户明细
     * @return
     */
    List<AccountDetailResult> getAccountDetail(Integer pageSize, Integer pageNum);
    
    /**
     * 获取团队人员列表
     * @param memberId
     * @param pageSize
     * @param pageNum
     * @return
     */
    List<TeamMemberResult> getTeamList(Long memberId, Integer pageSize, Integer pageNum);
    
    /**
     * 获取会员提现记录
     * @param pageSize
     * @param pageNum
     * @return
     */
    List<MemberWithdrawApplyResult> getWithdrawApply(Integer pageSize, Integer pageNum);
    
    /**
     * 会员提现申请
     * @return
     */
    CommonResult withdrawApply(WithdrawApplyParam applyParam);
    
    /**
     * 会员转账
     * @param transferParam
     * @return
     */
    CommonResult transfer(MemberTransferParam transferParam);
    
    /**
     * 获取会员转账记录
     * @param pageSize
     * @param pageNum
     * @return
     */
    List<MemberTransferResult> getTransferList(Integer pageSize, Integer pageNum);
    
    /**
     * 注册完善个人资料
     * @param memberInfoParam
     * @return
     */
    CommonResult<String> firstSaveMemberInfo(FirstMemberInfoParam memberInfoParam);
    
    /**
     * 根据手机号获取用户真实姓名
     * @param phone
     * @return
     */
    CommonResult<Map<String, String>> getRealName(String phone);
}
