/*
*  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.shop;

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 javax.validation.constraints.*;
import java.math.BigDecimal;
import java.io.Serializable;
import java.util.Date;

/**
* @website https://eladmin.vip
* @description /
* @author lyf
* @date 2024-03-01
**/
@Entity
@Data
@Table(name="tb_shop_user")
public class TbShopUser implements Serializable {

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

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

    @Column(name = "`credit_amount`")
    @ApiModelProperty(value = "授权金额")
    private BigDecimal creditAmount;

    @Column(name = "`consume_amount`")
    @ApiModelProperty(value = "消费累计")
    private BigDecimal consumeAmount;

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

    @Column(name = "`level_consume`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "等级积分")
    private BigDecimal levelConsume;

    @Column(name = "`status`")
    @ApiModelProperty(value = "0-不可使用 1可使用")
    private Integer status;

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

    @Column(name = "`shop_id`",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "店铺Id")
    private String shopId;

    @Column(name = "`user_id`")
    @ApiModelProperty(value = "用户Id")
    private String userId;

    @Column(name = "`parent_id`")
    @ApiModelProperty(value = "上级Id")
    private String parentId;

    @Column(name = "`parent_level`")
    @ApiModelProperty(value = "上级的层级")
    private String parentLevel;

    @Column(name = "`name`")
    @ApiModelProperty(value = "真实名字")
    private String name;

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

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

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

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

    @Column(name = "`is_vip`")
    @ApiModelProperty(value = "是否会员，")
    private Integer isVip;

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

    @Column(name = "`is_attention`")
    @ApiModelProperty(value = "是否通过关注而成为会员的，此字段固定后不改")
    private Integer isAttention;

    @Column(name = "`attention_at`")
    @ApiModelProperty(value = "关注时间")
    private Integer attentionAt;

    @Column(name = "`is_shareholder`")
    @ApiModelProperty(value = "是否股东（分销商）")
    private Integer isShareholder;

    @Column(name = "`level`")
    @ApiModelProperty(value = "层级1-顶级 2-次级 3最低")
    private Integer level;

    @Column(name = "`distribute_type`")
    @ApiModelProperty(value = "分销类型 auto-自动获取 set手动设置 charge充值")
    private String distributeType;

    @Column(name = "`sort`")
    @ApiModelProperty(value = "排序")
    private Integer sort;

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

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

    @Column(name = "`mini_open_id`")
    @ApiModelProperty(value = "小程序openId")
    private String miniOpenId;
    @Column(name = "`dynamic_code`")
    private String dynamicCode;


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