package com.gyee.wisdom.dao.sql.point.entity;

import com.gyee.wisdom.common.data.ToData;
import com.gyee.wisdom.common.data.point.LevelTypeTestingPoint;
import com.gyee.wisdom.common.data.point.TestingPoint;
import com.gyee.wisdom.common.data.point.WindturbineTestingPoint;
import com.gyee.wisdom.dao.sql.ModelConstants;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

/**
 *Author:Wanghs
 */

@Data
@NoArgsConstructor
@ToString
@EqualsAndHashCode()
@Entity
@Table(name = ModelConstants.WINDTURBINE_TESTING_POINT)
public class WindturbineTestingPointEntity implements ToData<WindturbineTestingPoint> {


    //编号（主键）
    @Id
    @Column(name = ModelConstants.ID_)
    private String id;

    //编码
    @Column(name = ModelConstants.CODE_)
    private String code;

    //名称
    @Column(name = ModelConstants.NAME_)
    private String name;

    //型号名称
    @Column(name = ModelConstants.MODEL_)
    private String model;

    //单位
    @Column(name = ModelConstants.VALUE_UNIT)
    private String valueUnit;

    //英文名称
    @Column(name = ModelConstants.ENGLISH_NAME)
    private String englishName;

    //所属型号
    @Column(name = ModelConstants.MODEL_ID)
    private String modelId;

    //风机编号
    @Column(name = ModelConstants.WINDTURBINE_ID)
    private String windturbineId;

    //统一编码
    @Column(name = ModelConstants.UNIFORM_CODE)
    private String uniformCode;

    //风场编码
    @Column(name = ModelConstants.STATION_ID)
    private String stationId;

    //数据类型
    @Column(name = ModelConstants.DATA_TYPE)
    private String dataType;

    //工程编号
    @Column(name = ModelConstants.PROJECT_ID)
    private String projectId;

    //风电线编号
    @Column(name = ModelConstants.LINE_ID)
    private String lineId;

    // 分类（1遥测、2遥信、3遥调、4遥控、5计算）
    @Column(name = ModelConstants.CATEGORY_)
    private int category;

    public WindturbineTestingPointEntity(WindturbineTestingPoint point){
        this.id = point.getId();
        this.code = point.getCode();
        this.name = point.getName();
        this.model = point.getModel();
        this.valueUnit = point.getValueUnit();
        this.englishName = point.getEnglishName();
        this.modelId = point.getModelId();
        this.windturbineId = point.getWindturbineId();
        this.uniformCode = point.getUniformCode();
        this.stationId = point.getStationId();
        this.dataType = point.getDataType();
        this.projectId = point.getProjectId();
        this.lineId = point.getLineId();
        this.category = point.getCategory();


    }
    @Override
    public WindturbineTestingPoint toData() {
        WindturbineTestingPoint data = new WindturbineTestingPoint();
        data.setId(this.id);
        data.setCode(this.code);
        data.setName(this.name);
        data.setModel(this.model);
        data.setValueUnit(this.valueUnit);
        data.setEnglishName(this.englishName);
        data.setModelId(this.modelId);
        data.setWindturbineId(this.windturbineId);
        data.setUniformCode(this.uniformCode);
        data.setStationId(this.stationId);
        data.setDataType(this.dataType);
        data.setProjectId(this.projectId);
        data.setLineId(this.lineId);
        data.setCategory(this.category);

        return data;
    }
}
