package com.wsm.admin.model;

import com.alibaba.fastjson.annotation.JSONField;
import com.wsm.common.model.BaseModel;
import net.minidev.json.annotate.JsonIgnore;
import org.hibernate.annotations.Where;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * 设备事件表
 */
@Entity
@Table(name = "tb_device_event")
@Where(clause = "rec_status='A'")
public class DeviceEvent extends BaseModel implements Serializable {

    private static final long serialVersionUID = 5512725645194142786L;

    @ManyToOne(fetch = FetchType.EAGER)
    private Device device;
    /**
     * 事件内容
     */
    private String content;

    /**
     * 事件异常状态: 0-正常  1-报警  2-低压  3-故障
     *
     */
    @Column
    private Integer status;

    /**
     * 处理状态：0-待解决, 1-已立案，2-出警中，3-已解决
     */
    @Column(length = 2)
    private Byte handleStatus;




    /**
     * 上报时间 作去重校验
     */
    @Temporal(TemporalType.TIMESTAMP)
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private Date postTime;

    public Device getDevice() {
        return device;
    }

    public void setDevice(Device device) {
        this.device = device;
    }

    public String getContent() {
        return content;
    }

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

    public Byte getHandleStatus() {
        return handleStatus;
    }

    public void setHandleStatus(Byte handleStatus) {
        this.handleStatus = handleStatus;
    }


    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Date getPostTime() {
        return postTime;
    }

    public void setPostTime(Date postTime) {
        this.postTime = postTime;
    }

    @Override
    public String toString() {
        return "DeviceEvent{" +
                "device=" + device +
                ", content='" + content + '\'' +
                ", handleStatus=" + handleStatus +
                ", postTime=" + postTime +
                '}';
    }
}
