package com.bizzan.bitrade.entity;

import com.bizzan.bitrade.constant.CommonStatus;
import com.bizzan.bitrade.constant.MemberLevelEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;

/**
 * @author QQ 2232965526
 * @date 2020年01月31日
 */
@ApiModel("登录用户")
@Data
@Builder
public class LoginInfo {
	@ApiModelProperty("用户名")
    private String username;
    private Location location;
    private MemberLevelEnum memberLevel;
	@ApiModelProperty("登录token")
    private String token;
    private String realName;
    private Country country;
    private String avatar;
	@ApiModelProperty("邀请码")
    private String promotionCode;
    private long id;
    private int loginCount;
    private String superPartner;
	@ApiModelProperty("谷歌状态 0或空未绑定 1已绑定")
    private Integer googleStatus;
    /**
     * 推广地址前缀
     */
    private String promotionPrefix;
    private boolean serviceStaff;

    /**
     * 签到能力
     */
    private Boolean signInAbility;
    
    private int firstLevel = 0; // 一级邀请好友数量
    private int secondLevel = 0; // 二级邀请好友数量
    private int thirdLevel = 0; // 三级邀请好友数量
    
    /**
     * 是否存在签到活动
     */
    private Boolean signInActivity;
    private  String memberRate ;
    private CommonStatus status;

    public static LoginInfo getLoginInfo(Member member, String token, Boolean signInActivity, String prefix) {
        return LoginInfo.builder().location(member.getLocation())
                .memberLevel(member.getMemberLevel())
                .username(member.getUsername())
                .token(token)
                .realName(member.getRealName())
                .country(member.getCountry())
                .avatar(member.getAvatar())
                .promotionCode(member.getPromotionCode())
                .id(member.getId())
                .loginCount(member.getLoginCount())
                .superPartner(member.getSuperPartner())
                .promotionPrefix(prefix)
                .signInAbility(member.getSignInAbility())
                .signInActivity(signInActivity)
                .firstLevel(member.getFirstLevel())
                .secondLevel(member.getSecondLevel())
                .thirdLevel(member.getThirdLevel())
                .googleStatus(member.getGoogleState())
                .status(member.getStatus())
                .serviceStaff(member.getIsService()!=null && member.getIsService()==1)
                .build();
    }
}
