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

import com.gyee.wisdom.common.data.ToData;
import com.gyee.wisdom.common.data.alarm.Warningfj;
import com.gyee.wisdom.common.data.alarm.Warningsyz;
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="warningsyz")
public class WarningsyzEntity implements ToData<Warningsyz>,Serializable {


    private static final long serialVersionUID = 7086505699466420713L;
    @Id
    @Column(name = "id")
    private String id;
    @Column(name = "pointkey")
    private String pointkey;
    @Column(name = "description")
    private String description;
    @Column(name = "area1")
    private String area1;
    @Column(name = "area2")
    private String area2;
    @Column(name = "stationid")
    private String stationid;
    @Column(name = "levelid")
    private String levelid;
    @Column(name = "enabled")
    private int enabled;
    @Override
    public Warningsyz toData() {
        if(this!=null) {
            Warningsyz warning = new Warningsyz();
            BeanUtils.copyProperties(this,warning);
            return warning;
        }else{
            return null;
        }

    }

    public WarningsyzEntity(Warningsyz warning){
          this.id=warning.getId();
          this.pointkey=warning.getPointkey();
          this.description=warning.getDescription();
          this.area1=warning.getArea1();
          this.area2=warning.getArea2();
          this.stationid=warning.getStationid();
          this.levelid=warning.getLevelid();
          this.enabled=warning.getEnabled();
    }

}
