/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.system.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.common.cache.DictBizCache;
import org.springblade.common.cache.DictCache;
import org.springblade.common.cache.ParamCache;
import org.springblade.common.constant.CommonConstant;
import org.springblade.common.enums.DictBizEnum;
import org.springblade.common.enums.DictEnum;
import org.springblade.core.tool.utils.StringUtil;
import org.springblade.modules.system.entity.UserApp;
import org.springframework.format.annotation.DateTimeFormat;

import java.math.BigDecimal;
import java.util.Date;

/**
 * 视图实体类
 *
 * @author Chill
 */
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "UserAppVO对象", description = "UserAppVO对象")
public class UserAppVO extends UserApp {
	private static final long serialVersionUID = 1L;

	@ApiModelProperty(value = "主键ID, 不是用户ID")
	private Long id;

	@ApiModelProperty(value = "邀请码")
	private String code;

	@ApiModelProperty(value = "昵称")
	private String name;

	@ApiModelProperty(value = "账号")
	private String username;

	@ApiModelProperty(value = "真名")
	private String realName;

	@ApiModelProperty(value = "头像")
	private String avatar;

	@JsonIgnore
	private String parentPath;

	@ApiModelProperty(value = "是否管理员")
	private Integer isAdmin;

	@ApiModelProperty(value = "是否有特殊权限")
	private String enableAuthDisplayName;
	@ApiModelProperty(value = "是否是团长")
	private String livingHallDisplayName;

	@ApiModelProperty(value = "是否认证")
	private Integer isOauth;

	@ApiModelProperty(value = "是否默认地址")
	private Integer isAddress;

	@ApiModelProperty(value = "性别")
	private Integer sex;

	@ApiModelProperty(value = "性别")
	private String sexDisplayName;

	@ApiModelProperty(value = "用户状态")
	private String stateDisplayName;

	@ApiModelProperty(value = "团队人数")
	private Integer teamNum;

	@DateTimeFormat(pattern = "yyyy-MM-dd")
	@JsonFormat(pattern = "yyyy-MM-dd")
	@ApiModelProperty(value = "生日,格式yyyy-MM-dd")
	private Date birthday;

	@ApiModelProperty(value = "身份证号")
	private String idCard;

	@ApiModelProperty(value = "正面")
	private String positiveUrl;

	@ApiModelProperty(value = "反面")
	private String negativeUrl;

	@ApiModelProperty("创建时间")
	private Date createTime;

	@ApiModelProperty("人脸认证订单支付标识,默认0未支付,1已支付")
	private Integer FacePay = 0;

	@ApiModelProperty("用户活跃度")
	private String userActive;

	@ApiModelProperty("手机号")
	private String phone;

	@ApiModelProperty("是否有支付密码")
	private Integer isPayPassword;

	@ApiModelProperty("加速提现封顶额度")
	private BigDecimal accelerateWithdrawalCaps;

	@ApiModelProperty("普通提现封顶额度")
	private BigDecimal normalWithdrawalCaps;

	@ApiModelProperty("红包提现手续费")
	private BigDecimal redWithdrawalRatio;

	@ApiModelProperty("微信二维码")
	private String wxQrcode;

	@ApiModelProperty("自提点ID")
	private Long selfTakeId;

	private Long userType;

	public String getEnableAuthDisplayName() {
		return DictCache.getValue(DictEnum.YES_NO, this.getEnableAuth());
	}

	public String getLivingHallDisplayName() {
		return DictCache.getValue(DictEnum.YES_OR_NO, this.getLivingHall());
	}


	public String getStateDisplayName() {
		return DictBizCache.getValue(DictBizEnum.USER_STATE, this.getState());
	}
}
