package com.ruoyi.member.domain;

import com.ruoyi.common.annotation.Excel;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.constant.DictConstants;
import lombok.*;
import com.ruoyi.common.core.domain.DlBaseEntity;

/**
 * 会员对象 dl_member_user
 *
 * @author pqz
 * @date 2025-03-17
 */
@TableName("dl_member_user")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class MemberUser extends DlBaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 唯一主键 */
    @TableId(type = IdType.ASSIGN_UUID)
    private String id;

    /** 用户类型（数据字典：dl_user_type） */
    @Excel(name = "用户类型", readConverterExp = "数=据字典：dl_user_type")
    private String userType;

    /** 通告主身份类型,为null时就是未认证（数据字典：dl_identity_type） */
    @Excel(name = "通告主身份类型,为null时就是未认证", readConverterExp = "数=据字典：dl_identity_type")
    private String identityType;

    /** 用户表id */
    private Long userId;

    /** 联系方式 */
    @Excel(name = "联系方式")
    private String tel;

    /** 通告主-本月通告发布剩余额度 */
    @Excel(name = "通告主-本月通告发布剩余额度")
    private Integer tremaining;

    /** 通告主-个人累计已发布通告数量 */
    @Excel(name = "通告主-个人累计已发布通告数量")
    private Long ttotalNum;

    /** 通告主-个人粉丝数量 */
    @Excel(name = "通告主-个人粉丝数量")
    private Integer tfansNum;

    /** 通告主-是否开启报名免打扰(0否|1开启) */
    @Excel(name = "通告主-是否开启报名免打扰(0否|1开启)")
    private String topenDisturb;

    /** 通告主-收款码姓名 */
    @Excel(name = "通告主-收款码姓名")
    private String trecipientName;

    /** 通告主-收款码图片地址 */
    @Excel(name = "通告主-收款码图片地址")
    private String trecipientImage;

    /** 博主-剩余积分 */
    @Excel(name = "博主-剩余积分")
    private Long bpoints;
    /**
     * 博主剩余报名次数
     */
    private Long sendReportNum;
    /**
     * 判断是否领过0否1是
     */
    private String isGetGift;


    public MemberUser (String userType, SysUser user,Integer addNotice){
        this.userType = userType;
        this.userId = user.getUserId();
        this.tel = user.getPhonenumber();
        if(DictConstants.USER_TYPE_BZ.equals(userType)){
            //博主
            this.bpoints=0L;
        }else{
            //通告主
            this.tremaining = addNotice;
            this.ttotalNum = 0L;
            this.tfansNum = 0;
            this.topenDisturb = DictConstants.YES_NO_NO;
        }
    }
}
