package com.zd.laboratory.domain;

import cn.hutool.core.util.StrUtil;
import com.zd.common.core.annotation.Excel;
import com.zd.common.core.domain.qc.QCInterface;
import com.zd.common.core.web.domain.BaseEntity;
import com.zd.laboratory.interfaces.SysProperties;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.hibernate.validator.constraints.Length;

import java.util.Date;

/**
 * 实验室安全制度对象 lab_safe_book
 *
 * @author liubo
 * @date 2021-11-19
 */
@ApiModel("实验室安全制度")
public class LabSafeBook extends BaseEntity implements QCInterface {
    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @ApiModelProperty(value = "${comment}")
    private Long id;
    /**
     * 制度类别 取自字典 safe_type
     */
    @Excel(name = "制度类别 取自字典 safe_type")
    @Length(message = "制度类别 取自字典 safe_type长度不能超过32")
    @ApiModelProperty(value = "制度类别 取自字典 safe_type")
    private String type;

    private String typeLable;

    /**
     * 名称
     */
    @Excel(name = "名称")
    @Length(message = "名称长度不能超过128")
    @ApiModelProperty(value = "名称")
    private String name;
    /**
     * 编号
     */
    @Excel(name = "编号")
    @Length(message = "编号长度不能超过32")
    @ApiModelProperty(value = "编号")
    private String code;
    /**
     * 内容
     */
    @Excel(name = "内容")
    @ApiModelProperty(value = "内容")
    private String content;
    /**
     * 二维码地址
     */
    @Excel(name = "二维码地址")
    @Length(message = "二维码地址长度不能超过255")
    @ApiModelProperty(value = "二维码地址")
    private String qrCodeUrl;
    /**
     * 查看次数
     */
    @Excel(name = "查看次数")
    @ApiModelProperty(value = "查看次数")
    private Integer scanCount = 0;

    private Date beginTime;

    private Date endTime;

    public String getTypeLable() {
        return typeLable;
    }

    public void setTypeLable(String typeLable) {
        this.typeLable = typeLable;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getId() {
        return id;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getType() {
        return type;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getCode() {
        return code;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getContent() {
        return content;
    }

    public void setQrCodeUrl(String qrCodeUrl) {
        this.qrCodeUrl = qrCodeUrl;
    }

    public void setScanCount(Integer scanCount) {
        this.scanCount = scanCount;
    }

    public Integer getScanCount() {
        if(this.scanCount == null){
            return 0;
        }
        return scanCount;
    }

    public Date getBeginTime() {
        return beginTime;
    }

    public void setBeginTime(Date beginTime) {
        this.beginTime = beginTime;
    }

    public Date getEndTime() {
        return endTime;
    }

    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }

    @Override
    public String getQrCodeUrl() {
        return StrUtil.format(SysProperties.getQrcodeFormat(),id,2) ;
    }
}
