package com.zd.laboratory.domain.vo;

import cn.hutool.core.util.StrUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.zd.common.core.enums.WarnMessageTypeEnum;
import com.zd.common.core.enums.WarnUserAttrEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.util.Date;
import java.util.Optional;

/**
 * 预警推送消息对象 lab_warn_push_message
 * 
 * @author zhoupan
 * @date 2021-10-06
 */
@ApiModel("预警推送消息ListVO")
public class LabWarnPushMessageListVO
{

    /** 推送类型0：语音 1：短信 */
    @ApiModelProperty(value = "推送类型0：语音 1：短信")
    private WarnMessageTypeEnum pushType;

    @ApiModelProperty("收信人名称")
    private String recipientName;

    @ApiModelProperty("实验室名称")
    private String subName;

    @ApiModelProperty(value = "人员属性0：负责人1：内部人员")
    private WarnUserAttrEnum userAttributes;


    public String getShowInfo()
    {
        if(WarnMessageTypeEnum.voice.equals(pushType))
        {
            return subName;
        }
        if(WarnMessageTypeEnum.SMS.equals(pushType))
        {
            return StrUtil.format("{}-{}",userAttributes.getName(), Optional.ofNullable(recipientName).orElseGet(()->StrUtil.EMPTY)) ;
        }
        return "";
    }

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "创建时间")
    private Date createTime;


    public WarnMessageTypeEnum getPushType() {
        return pushType;
    }

    public void setPushType(WarnMessageTypeEnum pushType) {
        this.pushType = pushType;
    }

    public String getRecipientName() {
        return recipientName;
    }

    public void setRecipientName(String recipientName) {
        this.recipientName = recipientName;
    }

    public String getSubName() {
        return subName;
    }

    public void setSubName(String subName) {
        this.subName = subName;
    }

    public WarnUserAttrEnum getUserAttributes() {
        return userAttributes;
    }

    public void setUserAttributes(WarnUserAttrEnum userAttributes) {
        this.userAttributes = userAttributes;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}
