package com.gyee.wisdom.dao.sql.alarm.Entity;

import com.gyee.wisdom.common.data.ToData;
import com.gyee.wisdom.common.data.alarm.Warning;
import com.gyee.wisdom.dao.sql.ModelConstants;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;

@Data
@Entity
@NoArgsConstructor
@Table(name="warning2")
public class WarningEntity  implements ToData<Warning>,Serializable{

    private static final long serialVersionUID = -3888921205274103285L;
    @Id
    private String id;
    @Column(name = "levelid")
    private String levelId;
    @Column(name = "manufacturercode")
    private String manuFactureRcode;
    @Column(name = "englishtext")
    private String englishText;
    @Column(name = "chinesetext")
    private String chineseText;
    @Column(name = "parentid")
    private String parentId;
    @Column(name = "isleaf")
    private Integer isLeaf;
    @Column(name = "sequencenumber")
    private Integer sequenceNumber;
    @Column(name = "characteristic")
    private String characterIstic;
    @Column(name = "modelid")
    private String modelId;
    @Column(name = "codename")
    private String codeName;
    @Column(name = "ednavalue")
    private Integer ednaValue;
    @Column(name = "display")
    private Integer display;
    @Column(name = "warningclassifyid")
    private String warningClassifyId;
    @Column(name = "standardtime")
    private Double standardTime;
    @Column(name = "isreset")
    private Integer isReset;
//    @Column(name = "warningtypeid")
//    private String warningTypeId;
    @Column(name="relatedparts")
    private String relatedParts;

    @Column(name="enabled")
    private int enabled;

    @Override
    public Warning toData() {
        Warning warning = new Warning();
        BeanUtils.copyProperties(this,warning);
        return warning;
    }



    public WarningEntity(Warning warning){
        this.id = warning.getId();
        this.levelId = warning.getLevelId();
        this.manuFactureRcode = warning.getManuFactureRcode();
        this.englishText= warning.getEnglishText();
        this.chineseText =warning.getChineseText();
        this.parentId = warning.getParentId();
        this.isLeaf = warning.getIsLeaf();
        this.sequenceNumber =warning.getSequenceNumber();
        this.characterIstic =warning.getCharacterIstic();
        this.modelId  = warning.getModelId();
        this.codeName = warning.getCodeName();
        this.ednaValue=warning.getEdnaValue();
        this.display = warning.getDisplay();
        this.warningClassifyId  = warning.getWarningClassifyId();
        this.standardTime = warning.getStandardTime();
        this.isReset = warning.getIsReset();
//        this.warningTypeId = warning.getWarningTypeId();
        this.enabled = warning.getEnabled();
    }


}
