package com.gyee.wisdom.dao.sql.alarm.Entity;
import com.gyee.wisdom.common.data.ToData;
import com.gyee.wisdom.common.data.alarm.Alertsnap;
import com.gyee.wisdom.common.data.alarm.AlertsnapNew;
import lombok.Data;
import lombok.NoArgsConstructor;
//import org.hibernate.annotations.GenericGenerator;
import org.springframework.beans.BeanUtils;

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

@Data
@Entity
@NoArgsConstructor
@Table(name = "alertsnap")
//@GenericGenerator(name = "NXFD_ALERTSNAP_NEW", strategy = "NXFD_ALERTSNAP_NEW")
public class AlertsnapNewEntity implements ToData<AlertsnapNew>,Serializable{
    private static final long serialVersionUID = -8348826240826071549L;
    @Id
    @Column(name = "id")
//    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "NXFD_ALERTSNAP_NEW")
//    @SequenceGenerator(name = "NXFD_ALERTSNAP_NEW", sequenceName = "NXFD_ALERTSNAP_NEW")
    private Long id;
    @Column(name = "stationid")
    private String stationId;
    @Column(name = "projectid")
    private String projectId;
    @Column(name = "lineid")
    private String lineId;
    @Column(name = "windturbineid")
    private String windturbineId;
    @Column(name = "alertvalue")
    private int alertValue;
    @Column(name = "category1")
    private String cateGory1;
    @Column(name = "category2")
    private String cateGory2;
    @Column(name = "category3")
    private String cateGory3;
    @Column(name = "rank")
    private String rank;
    @Column(name = "isopened")
    private int isOpened;
    @Column(name = "isconfirmed")
    private int isConfirmed;
    @Column(name = "confirmtime")
    private Date confirmTime;
    @Column(name = "confirmperson")
    private String confirmPerson;
    @Column(name = "lastupdatetime")
    private Date lastUpdateTime;
    @Column(name = "lastupdateperson")
    private String lastUpdatePerson;
    @Column(name = "stationname")
    private String stationName;
    @Column(name = "projectname")
    private String projectName;
    @Column(name = "linename")
    private String lineName;
    @Column(name = "windturbinename")
    private String windturbineName;
    @Column(name = "alerttext")
    private String alertText;
    @Column(name = "modelid")
    private String modelId;
    @Column(name = "testingpointkey")
    private String testingpointKey;
    @Column(name = "ifixpicture")
    private String ifixPicture;
    @Column(name = "ifixtag")
    private String ifixTag;
    @Column(name = "lastclosetime")
    private Date lastCloseTime;
    @Column(name = "lastcloseperson")
    private String lastClosePerson;
    @Column(name = "datainfo")
    private String dataInfo;

    @Override
    public AlertsnapNew toData() {

        AlertsnapNew alertsnap = new AlertsnapNew();
        BeanUtils.copyProperties(this,alertsnap);
        return alertsnap;

    }

    public AlertsnapNewEntity(AlertsnapNew alertsnap) {

            this.id = alertsnap.getId();
            this.stationId = alertsnap.getStationId();
            this.projectId = alertsnap.getProjectId();
            this.lineId = alertsnap.getLineId();
            this.windturbineId = alertsnap.getWindturbineId();
            this.alertValue = alertsnap.getAlertValue();
            this.cateGory1 = alertsnap.getCateGory1();
            this.cateGory2 = alertsnap.getCateGory2();
            this.cateGory3 = alertsnap.getCateGory3();
            this.rank = alertsnap.getRank();
            this.isOpened = alertsnap.getIsOpened();
            this.isConfirmed = alertsnap.getIsConfirmed();
            this.confirmTime = alertsnap.getConfirmTime();
            this.confirmPerson = alertsnap.getConfirmPerson();
            this.lastUpdateTime = alertsnap.getLastUpdateTime();
            this.lastUpdatePerson = alertsnap.getLastUpdatePerson();
            this.stationName = alertsnap.getStationName();
            this.projectName = alertsnap.getProjectName();
            this.lineName = alertsnap.getLineName();
            this.windturbineName = alertsnap.getWindturbineName();
            this.alertText = alertsnap.getAlertText();
            this.modelId = alertsnap.getModelId();
            this.testingpointKey = alertsnap.getTestingpointKey();
            this.ifixPicture = alertsnap.getIfixPicture();
            this.ifixTag = alertsnap.getIfixTag();
            this.lastCloseTime = alertsnap.getLastCloseTime();
            this.lastClosePerson = alertsnap.getLastClosePerson();
            this.dataInfo = alertsnap.getDataInfo();

    }

}
