package com.rj.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;

@Data
@EqualsAndHashCode(callSuper = false)
@TableName("lb_user")
@Schema(description = "LB 用户表")
@JsonIgnoreProperties(ignoreUnknown = true)
public class LbUser implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.INPUT)
    @Schema(description = "用户ID（外部系统主键）")
    private Long id;

    @TableField("tenant_id")
    @Schema(description = "租户ID")
    private String tenantId;

    @TableField("pid")
    @Schema(description = "上级用户ID")
    private Long pid;

    @TableField("username")
    @Schema(description = "用户名")
    private String username;

    @TableField("nickname")
    @Schema(description = "昵称")
    private String nickname;

    @TableField("mobile")
    @Schema(description = "手机号")
    private String mobile;

    @TableField("password")
    @Schema(description = "密码（加密后）")
    private String password;

    @TableField("salt")
    @Schema(description = "密码盐")
    private String salt;

    @TableField("sex")
    @Schema(description = "性别")
    private String sex;

    @TableField("avatar")
    @Schema(description = "头像路径")
    private String avatar;

    @TableField("invite")
    @Schema(description = "邀请码")
    private String invite;

    @TableField("level")
    @Schema(description = "等级")
    private Integer level;

    @TableField("birthday")
    @Schema(description = "生日")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private LocalDate birthday;

    @TableField("money")
    @Schema(description = "余额")
    private BigDecimal money;

    @TableField("coupon")
    @Schema(description = "优惠券金额")
    private BigDecimal coupon;

    @TableField("self_bonus")
    @Schema(description = "自购奖金")
    private BigDecimal selfBonus;

    @TableField("share_bonus")
    @Schema(description = "分享奖金")
    private BigDecimal shareBonus;

    @TableField("score")
    @Schema(description = "积分")
    private Integer score;

    @TableField("last_time")
    @Schema(description = "最后登录时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime lastTime;

    @TableField("last_ip")
    @Schema(description = "最后登录IP")
    private String lastIp;

    @TableField("join_time")
    @Schema(description = "注册时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime joinTime;

    @TableField("join_ip")
    @Schema(description = "注册IP")
    private String joinIp;

    @TableField("token")
    @Schema(description = "登录令牌")
    private String token;

    @TableField("created_at")
    @Schema(description = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createdAt;

    @TableField("updated_at")
    @Schema(description = "更新时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updatedAt;

    @TableField("status")
    @Schema(description = "状态")
    private Integer status;

    @TableField("viptime")
    @Schema(description = "VIP到期时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime viptime;

    @TableField("is_vip")
    @Schema(description = "是否VIP：0否 1是")
    private Integer isVip;

    @TableField("contract")
    @Schema(description = "签约合同文件路径")
    private String contract;

    @TableField("max_order")
    @Schema(description = "最大订单数")
    private Integer maxOrder;

    @TableField("is_resell")
    @Schema(description = "是否可转卖：0否 1是")
    private Integer isResell;

    @TableField("yesterday_sell_count")
    @Schema(description = "昨日卖出笔数")
    private Integer yesterdaySellCount;

    @TableField("today_buy_count")
    @Schema(description = "今日买入笔数")
    private Integer todayBuyCount;

    @TableField("today_buy_total")
    @Schema(description = "今日买入总额")
    private BigDecimal todayBuyTotal;

    @TableField("today_sell_total")
    @Schema(description = "今日卖出总额")
    private BigDecimal todaySellTotal;

    @TableField("poor")
    @Schema(description = "贫困标识")
    private Integer poor;

    @TableField("pname")
    @Schema(description = "上级用户昵称")
    private String pname;
}
