package com.bocloud.ims.entity.resource;

import com.bocloud.common.utils.DateSerializer;
import com.bocloud.entity.annotations.Column;
import com.bocloud.entity.annotations.IgnoreAll;
import com.bocloud.entity.annotations.PK;
import com.bocloud.entity.annotations.Table;
import com.bocloud.entity.bean.GenericEntity;
import com.bocloud.entity.meta.PKStrategy;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
 * 告警实体类
 *
 * @author wangyu
 * @Version 1.0
 * @since 2017年7月10日
 */
@Table("resource_alarm")
public class ResourceAlarm extends GenericEntity {

    @PK(value = PKStrategy.AUTO)
    private Long id; // ID
    @Column("level")
    private String level;// 警告等级
    @Column("type")
    private String type;// 目标机器类型
    @Column("target")
    private Long target;// 目标机器
    @Column("deal_result")
    private String dealResult;// 处理结果
    @Column("alarm_val")
    private String alarmVal;// 告警的key值
    @Column("gmt_trigger")
    @JsonSerialize(using = DateSerializer.class)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date gmtTrigger;// 告警触发时间
    @Column("gmt_confirm")
    @JsonSerialize(using = DateSerializer.class)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date gmtConfirm;// 告警确认时间
    @Column("confirmer")
    private String confirmer;// 告警确认人
    @Column("gmt_solve")
    @JsonSerialize(using = DateSerializer.class)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date gmtSolve;// 告警解决时间
    @Column("solver")
    private String solver;// 告警解决人
    @Column("vendor_id")
    private Long vendorId; // 云供应商Id
    @Column("rule_id")
    private Long ruleId;// 告警规则ID
    @Column("event_alarm")
    private Boolean eventAlarm;// 是否是事件告警
    // @Column("result_status")
    // private Boolean resultStatus;// 结果状态
    // @Column("result")
    // private String result;// 结果
    @IgnoreAll
    private String vendorName; // 云供应商名称
    @Column("target_name")
    private String targetName; // 告警目标名称-告警对象（机器）

    /**
     *
     */
    public ResourceAlarm() {
        super();
    }

    /**
     * @param level
     * @param type
     * @param target
     * @param alarmVal
     * @param gmtTrigger
     * @param eventAlarm
     */
    public ResourceAlarm(String level, String type, Long target, String alarmVal, Date gmtTrigger, Boolean eventAlarm) {
        super();
        this.level = level;
        this.type = type;
        this.target = target;
        this.alarmVal = alarmVal;
        this.gmtTrigger = gmtTrigger;
        this.eventAlarm = eventAlarm;
    }

    /**
     * @param level
     * @param type
     * @param target
     * @param alarmVal
     * @param gmtTrigger
     * @param eventAlarm
     * @param resultStatus
     * @param result
     */
    public ResourceAlarm(String level, String type, Long target, String alarmVal, Date gmtTrigger, Boolean eventAlarm,
                         Boolean resultStatus, String result) {
        super();
        this.level = level;
        this.type = type;
        this.target = target;
        this.alarmVal = alarmVal;
        this.gmtTrigger = gmtTrigger;
        this.eventAlarm = eventAlarm;
    }

    /**
     * @return the id
     */
    public Long getId() {
        return id;
    }

    /**
     * @param id the id to set
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * @return the level
     */
    public String getLevel() {
        return level;
    }

    /**
     * @param level the level to set
     */
    public void setLevel(String level) {
        this.level = level;
    }

    /**
     * @return the type
     */
    public String getType() {
        return type;
    }

    /**
     * @param type the type to set
     */
    public void setType(String type) {
        this.type = type;
    }

    /**
     * @return the target
     */
    public Long getTarget() {
        return target;
    }

    /**
     * @param target the target to set
     */
    public void setTarget(Long target) {
        this.target = target;
    }

    /**
     * @return the alarmVal
     */
    public String getAlarmVal() {
        return alarmVal;
    }

    /**
     * @param alarmVal the alarmVal to set
     */
    public void setAlarmVal(String alarmVal) {
        this.alarmVal = alarmVal;
    }

    /**
     * @return the gmtTrigger
     */
    public Date getGmtTrigger() {
        return gmtTrigger;
    }

    /**
     * @param gmtTrigger the gmtTrigger to set
     */
    public void setGmtTrigger(Date gmtTrigger) {
        this.gmtTrigger = gmtTrigger;
    }

    /**
     * @return the gmtConfirm
     */
    public Date getGmtConfirm() {
        return gmtConfirm;
    }

    /**
     * @param gmtConfirm the gmtConfirm to set
     */
    public void setGmtConfirm(Date gmtConfirm) {
        this.gmtConfirm = gmtConfirm;
    }

    /**
     * @return the confirmer
     */
    public String getConfirmer() {
        return confirmer;
    }

    /**
     * @param confirmer the confirmer to set
     */
    public void setConfirmer(String confirmer) {
        this.confirmer = confirmer;
    }

    /**
     * @return the gmtSolve
     */
    public Date getGmtSolve() {
        return gmtSolve;
    }

    /**
     * @param gmtSolve the gmtSolve to set
     */
    public void setGmtSolve(Date gmtSolve) {
        this.gmtSolve = gmtSolve;
    }

    /**
     * @return the solver
     */
    public String getSolver() {
        return solver;
    }

    /**
     * @param solver the solver to set
     */
    public void setSolver(String solver) {
        this.solver = solver;
    }

    /**
     * @return the vendorId
     */
    public Long getVendorId() {
        return vendorId;
    }

    /**
     * @param vendorId the vendorId to set
     */
    public void setVendorId(Long vendorId) {
        this.vendorId = vendorId;
    }

    /**
     * @return the vendorName
     */
    public String getVendorName() {
        return vendorName;
    }

    /**
     * @param vendorName the vendorName to set
     */
    public void setVendorName(String vendorName) {
        this.vendorName = vendorName;
    }

    /**
     * @return the ruleId
     */
    public Long getRuleId() {
        return ruleId;
    }

    /**
     * @param ruleId the ruleId to set
     */
    public void setRuleId(Long ruleId) {
        this.ruleId = ruleId;
    }

    /**
     * @return the dealResult
     */
    public String getDealResult() {
        return dealResult;
    }

    /**
     * @param dealResult the dealResult to set
     */
    public void setDealResult(String dealResult) {
        this.dealResult = dealResult;
    }

    /**
     * @return the eventAlarm
     */
    public Boolean getEventAlarm() {
        return eventAlarm;
    }

    /**
     * @param eventAlarm the eventAlarm to set
     */
    public void setEventAlarm(Boolean eventAlarm) {
        this.eventAlarm = eventAlarm;
    }

    /**
     * @return the targetName
     */
    public String getTargetName() {
        return targetName;
    }

    /**
     * @param targetName the targetName to set
     */
    public void setTargetName(String targetName) {
        this.targetName = targetName;
    }

}
