package com.microservices.zone.member.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.microservices.common.core.annotation.Excel;
import com.microservices.common.core.web.domain.BaseEntity;
import com.microservices.system.api.domain.SysDept;
import com.microservices.system.api.domain.SysUser;
import com.microservices.zone.member.domain.vo.ZoneMemberDataVo;
import lombok.Data;

import java.util.Date;

/**
 * 特色专区会员对象 zone_member
 *
 * @author otto
 * @date 2023-05-16
 */
@Data
public class ZoneMember extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * 专区会员主键
     */
    private Long id;

    /**
     * 专区会员用户Id
     */
    @Excel(name = "专区会员用户Id")
    private Long userId;

    /**
     * 专区会员类型
     */
    @Excel(name = "专区会员类型")
    private Long memberTypeId;

    /**
     * 专区会员身份
     */
    @Excel(name = "专区会员身份")
    private Long memberLevelId;

    /**
     * 会员名称
     */
    private String name;
    /**
     * 排序
     */
    @Excel(name = "排序")
    private Integer sort;

    /**
     * 会员头像
     */
    private String imageUrl;

    /**
     * 会员介绍
     */
    private String introduction;

    /**
     * 是否已审核（0代表未审核 1代表已审核 2代表审核未通过 3代表邀请中）
     */
    private String isAudit;

    /**
     * 是否首页展示（0代表不展示 1代表展示）
     */
    private String isHomepage;

    /**
     * 所属组织Id
     */
    @Excel(name = "所属组织Id")
    private Long deptId;

    /**
     * 删除标志（0代表存在 2代表删除）
     */
    private String delFlag;

    /**
     * 专区标识
     */
    @Excel(name = "专区标识")
    private Long zoneId;
    private SysUser sysUser;
    private SysDept sysDept;
    private ZoneMemberLevel zoneMemberLevel;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date auditTime;

    public ZoneMemberDataVo toZoneMemberDataVo(String userName) {
        ZoneMemberDataVo zoneMemberDataVo = new ZoneMemberDataVo();
        zoneMemberDataVo.setId(this.id);
        zoneMemberDataVo.setName(this.name);
        zoneMemberDataVo.setImageUrl(this.imageUrl);
        zoneMemberDataVo.setIntroduction(this.introduction);
        zoneMemberDataVo.setMemberLevel(this.zoneMemberLevel.getName());
        zoneMemberDataVo.setLogin(userName);
        return zoneMemberDataVo;
    }
}
