package com.ruoyi.common.core.domain.entity;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonView;
import com.ruoyi.common.annotation.Sensitive;
import com.ruoyi.common.core.domain.JsonViewProfile;
import com.ruoyi.common.core.domain.ValidGroup;
import com.ruoyi.common.enums.DesensitizedType;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 * 普通用户信息对象 sm_user
 *
 * @author qzz
 * @date 2024-01-24
 */
@Data
public class SmUser extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 用户ID */
    @ApiModelProperty("用户id")
    @JsonView(JsonViewProfile.App.class)
    private Long userId;

    /** 用户账号 */
    @Excel(name = "用户名称")
    @ApiModelProperty("用户名称")
    @NotNull(message = "用户名称不允许为空", groups = {ValidGroup.Create.class})
    @JsonView(JsonViewProfile.App.class)
    @Sensitive(desensitizedType = DesensitizedType.USERNAME)
    private String userName;

    /** 用户昵称 */
    @Excel(name = "用户昵称")
    @ApiModelProperty("用户昵称")
    @JsonView(JsonViewProfile.App.class)
    @Sensitive(desensitizedType = DesensitizedType.USERNAME)
    private String nickName;

    /** 用户邮箱 */
    @Excel(name = "用户邮箱")
    @ApiModelProperty("用户邮箱")
    @Sensitive(desensitizedType = DesensitizedType.EMAIL)
    private String email;

    /** 手机号码 */
    @Excel(name = "手机号码")
    @ApiModelProperty("手机号码")
    @Sensitive(desensitizedType = DesensitizedType.PHONE)
    @JsonView(JsonViewProfile.App.class)
    @NotNull(message = "手机号码不允许为空", groups = {ValidGroup.Create.class})
    private String phonenumber;

    /** 出生日期 */
    @Excel(name = "出生日期")
    @ApiModelProperty("出生日期")
    private String birthday;

    /** 用户性别 */
    @Excel(name = "用户性别")
    @ApiModelProperty("用户性别，0男，1女，2未知")
    private String sex;

    /** 头像地址 */
    @Excel(name = "头像地址")
    @ApiModelProperty("头像地址")
    @JsonView(JsonViewProfile.App.class)
    private String avatar;

    /** 密码 */
    @Excel(name = "密码")
    @ApiModelProperty("密码")
    @Sensitive(desensitizedType = DesensitizedType.PASSWORD)
    private String password;

    /** 账户余额 */
    @Excel(name = "账户余额")
    @ApiModelProperty("账户余额")
    @JsonView(JsonViewProfile.App.class)
    private BigDecimal balance;

    /** 支付密码 */
    @Excel(name = "支付密码")
    @ApiModelProperty("支付密码")
    @Sensitive(desensitizedType = DesensitizedType.PASSWORD)
    private String payPassword;

    /** 帐号状态 */
    @Excel(name = "帐号状态")
    @ApiModelProperty("帐号状态")
    private String status;

    /** 删除标志 */
    @ApiModelProperty("删除标志")
    private String delFlag;

    /** 最后登录IP */
    @Excel(name = "最后登录IP")
    @ApiModelProperty("最后登录IP")
    private String loginIp;

    /** 最后登录时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd")
    @ApiModelProperty("最后登录时间")
    private Date loginDate;

    @ApiModelProperty("微信openId")
    private String wxOpenId;

    @ApiModelProperty("逻辑删除时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date deleteTime;

    @ApiModelProperty("是否商家")
    @JsonView(JsonViewProfile.App.class)
    private Boolean isMch;

    @ApiModelProperty("服务费费率")
    @JsonView(JsonViewProfile.App.class)
    private BigDecimal serviceRate;

    @ApiModelProperty("是否设备管理员")
    @JsonView(JsonViewProfile.AppMch.class)
    private Boolean deviceAdmin;

    @ApiModelProperty("服务费收取方式")
    @JsonView(JsonViewProfile.App.class)
    private String serviceType;

    @Excel(name = "提现服务费收取类型：1-百分比抽成，2-每笔提现收取")
    @ApiModelProperty("提现服务费收取类型：1-百分比抽成，2-每笔提现收取")
    @JsonView(JsonViewProfile.App.class)
    private String withdrawServiceType;

    @Excel(name = "提现服务费费")
    @ApiModelProperty("提现服务费费")
    @JsonView(JsonViewProfile.App.class)
    private BigDecimal withdrawServiceRate;

    @Excel(name = "真实姓名")
    @ApiModelProperty("真实姓名")
    @JsonView(JsonViewProfile.App.class)
    @Sensitive(desensitizedType = DesensitizedType.USERNAME)
    private String realName;

    @Excel(name = "身份证号")
    @ApiModelProperty("身份证号")
    @Sensitive(desensitizedType = DesensitizedType.ID_CARD)
    @JsonView(JsonViewProfile.App.class)
    private String realIdCard;

    @Excel(name = "实名认证手机号")
    @ApiModelProperty("实名认证手机号")
    @Sensitive(desensitizedType = DesensitizedType.PHONE)
    @JsonView(JsonViewProfile.App.class)
    private String realPhone;

    @ApiModelProperty("是否已经实名认证")
    @JsonView(JsonViewProfile.App.class)
    private Boolean isReal;

    @Excel(name = "是否限制提现")
    @ApiModelProperty("是否限制提现")
    @JsonView(JsonViewProfile.App.class)
    private Boolean limitWithdraw;

    @Excel(name = "限制提现原因")
    @ApiModelProperty("限制提现原因")
    @JsonView(JsonViewProfile.App.class)
    @Size(max = 200, message = "限制提现原因长度不能超过200个字符")
    private String limitWithdrawReason;

    @Excel(name = "是否限制退款")
    @ApiModelProperty("是否限制退款")
    private Boolean limitRefund;

    @Excel(name = "限制退款原因")
    @ApiModelProperty("限制退款原因")
    private String limitRefundReason;

    @Excel(name = "是否已阅读过商户协议")
    @ApiModelProperty("是否已阅读过商户协议")
    @JsonView(JsonViewProfile.App.class)
    private Boolean readMchLicence;

    @Excel(name = "风险提现次数")
    @ApiModelProperty("风险提现次数")
    private Integer riskCount;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "限制提现时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty("限制提现时间")
    private LocalDateTime limitWithdrawTime;

    @ApiModelProperty("用户类型")
    @NotNull(message = "用户类型不允许为空", groups = {ValidGroup.Create.class})
    @JsonView(JsonViewProfile.AppMch.class)
    private String type;

    @Excel(name = "代理商服务费比例")
    @ApiModelProperty("代理商服务费比例")
    @JsonView(JsonViewProfile.AppMch.class)
    private BigDecimal agentServiceRate;

    @Excel(name = "到账延迟时间", readConverterExp = "小=时")
    @ApiModelProperty("到账延迟时间")
    private Integer arrivalDelay;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "限制退款时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty("限制退款时间")
    private LocalDateTime limitRefundTime;

    @Excel(name = "订单是否查看用户手机号")
    @ApiModelProperty("订单是否查看用户手机号")
    @JsonView(JsonViewProfile.App.class)
    private Boolean showBillMobile;

    @Excel(name = "订单查看用户手机号所需的金额", readConverterExp = "元=/单")
    @ApiModelProperty("订单查看用户手机号所需的金额")
    @Min(value = 0, message = "订单显示用户手机号单价不允许小于0元/单")
    private BigDecimal showBillMobilePrice;

    @Excel(name = "代理商默认设备服务费率")
    @ApiModelProperty("代理商默认设备服务费率")
    @JsonView(JsonViewProfile.AppMch.class)
    private BigDecimal agentDeviceService;

    @ApiModelProperty("代理商是否允许商户开关设备")
    private Boolean agentAllowMchSwitch;

    @ApiModelProperty("支付宝openId")
    private String aliOpenId;
}
