/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package cn.ysk.cashier.pojo;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import java.math.BigDecimal;
import java.io.Serializable;

/**
* @website https://eladmin.vip
* @description /
* @author lyf
* @date 2023-11-13
**/
@Entity
@Data
@Table(name="tb_user_info")
public class TbUserInfo implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "`id`")
    @ApiModelProperty(value = "id")
    private Integer id;

    @Column(name = "`amount`")
    @ApiModelProperty(value = "钱包余额")
    private BigDecimal amount;

    @Column(name = "`charge_amount`")
    @ApiModelProperty(value = "累计充值")
    private BigDecimal chargeAmount;

    @Column(name = "`line_of_credit`")
    @ApiModelProperty(value = "授信额度")
    private BigDecimal lineOfCredit;

    @Column(name = "`consume_amount`")
    @ApiModelProperty(value = "consumeAmount")
    private BigDecimal consumeAmount;

    @Column(name = "`consume_number`")
    @ApiModelProperty(value = "消费次数累计")
    private Integer consumeNumber;

    @Column(name = "`total_score`")
    @ApiModelProperty(value = "总积分")
    private Integer totalScore;

    @Column(name = "`lock_score`")
    @ApiModelProperty(value = "锁定积分")
    private Integer lockScore;

    @Column(name = "`card_no`")
    @ApiModelProperty(value = "会员卡号")
    private String cardNo;

    @Column(name = "`card_password`")
    @ApiModelProperty(value = "会员密码")
    private String cardPassword;

    @Column(name = "`level_id`")
    @ApiModelProperty(value = "等级")
    private String levelId;

    @Column(name = "`head_img`")
    @ApiModelProperty(value = "用户头像")
    private String headImg;

    @Column(name = "`nick_name`")
    @ApiModelProperty(value = "用户昵称")
    private String nickName;

    @Column(name = "`telephone`")
    @ApiModelProperty(value = "电话号码")
    private String telephone;

    @Column(name = "`wx_ma_app_id`")
    @ApiModelProperty(value = "小程序Id")
    private String wxMaAppId;

    @Column(name = "`birth_day`")
    @ApiModelProperty(value = "会员生日")
    private String birthDay;

    @Column(name = "`sex`")
    @ApiModelProperty(value = "0-女 1男")
    private Integer sex;

    @Column(name = "`mini_app_open_id`")
    @ApiModelProperty(value = "小程序的openId")
    private String miniAppOpenId;

    @Column(name = "`open_id`")
    @ApiModelProperty(value = "公众号openId")
    private String openId;

    @Column(name = "`union_id`")
    @ApiModelProperty(value = "联合Id")
    private String unionId;

    @Column(name = "`code`")
    @ApiModelProperty(value = "用户编号")
    private String code;

    @Column(name = "`type`")
    @ApiModelProperty(value = "用户类型-保留字段")
    private String type;

    @Column(name = "`identify`")
    @ApiModelProperty(value = "'DOCTOR'-->医生，'USER'->用户")
    private Integer identify;

    @Column(name = "`status`")
    @ApiModelProperty(value = "1正常")
    private Integer status;

    @Column(name = "`parent_id`")
    @ApiModelProperty(value = "引荐人")
    private String parentId;

    @Column(name = "`parent_level`")
    @ApiModelProperty(value = "parentLevel")
    private String parentLevel;

    @Column(name = "`parent_type`")
    @ApiModelProperty(value = "上家类开型，店铺-SHOP/ 个人- PERSON")
    private String parentType;

    @Column(name = "`project_id`")
    @ApiModelProperty(value = "关注进入的活动Id")
    private String projectId;

    @Column(name = "`merchant_id`")
    @ApiModelProperty(value = "商户Id")
    private String merchantId;

    @Column(name = "`is_resource`")
    @ApiModelProperty(value = "0未认证，1认证")
    private Integer isResource;

    @Column(name = "`is_online`")
    @ApiModelProperty(value = "是否在线")
    private Integer isOnline;

    @Column(name = "`is_vip`")
    @ApiModelProperty(value = "isVip")
    private Integer isVip;

    @Column(name = "`vip_effect_at`")
    @ApiModelProperty(value = "vipEffectAt")
    private Integer vipEffectAt;

    @Column(name = "`tips`")
    @ApiModelProperty(value = "tips")
    private String tips;

    @Column(name = "`source_path`")
    @ApiModelProperty(value = "用户来源：公众号 WECHAT  小程序 WECHAT-APP 手机注册 TELEPHONE")
    private String sourcePath;

    @Column(name = "`is_sales_person`")
    @ApiModelProperty(value = "是否推广员 1 是 0不是")
    private Integer isSalesPerson;

    @Column(name = "`is_attention_mp`")
    @ApiModelProperty(value = "是否关注公众号")
    private Integer isAttentionMp;

    @Column(name = "`city`")
    @ApiModelProperty(value = "城市")
    private String city;

    @Column(name = "`search_word`")
    @ApiModelProperty(value = "searchWord")
    private String searchWord;

    @Column(name = "`last_log_in_at`")
    @ApiModelProperty(value = "最近登陆时间")
    private Long lastLogInAt;

    @Column(name = "`last_leave_at`")
    @ApiModelProperty(value = "lastLeaveAt")
    private Long lastLeaveAt;

    @Column(name = "`created_at`")
    @ApiModelProperty(value = "createdAt")
    private Long createdAt;

    @Column(name = "`updated_at`")
    @ApiModelProperty(value = "updatedAt")
    private Long updatedAt;

    @Column(name = "`bind_parent_at`")
    @ApiModelProperty(value = "绑定时间")
    private Long bindParentAt;

    @Column(name = "`grand_parent_id`")
    @ApiModelProperty(value = "上上家")
    private String grandParentId;

    public void copy(TbUserInfo source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
