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

import com.gyee.wisdom.common.data.ToData;
import com.gyee.wisdom.common.data.point.ElectricalTestingPoint;
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.ELECTRICAL_TESTING_POINT)
public class ElectricalTestingPointEntity implements ToData<ElectricalTestingPoint> {

    /**
     * 主键ID
     */
    @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.VALUE_UNIT)
    private String valueUnit;

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

    /**
     * 统一编码
     */
    @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.TYPE_ID)
    private int typeId;


    public ElectricalTestingPointEntity(ElectricalTestingPoint point) {
        this.id = point.getId();
        this.code = point.getCode();
        this.name = point.getName();
        this.valueUnit = point.getValueUnit();
        this.englishName = point.getEnglishName();
        this.uniformCode = point.getUniformCode();
        this.stationId = point.getStationId();
        this.dataType = point.getDataType();
        this.typeId = point.getTypeId();


    }

    @Override
    public ElectricalTestingPoint toData() {
        ElectricalTestingPoint data = new ElectricalTestingPoint();
        data.setId(this.id);
        data.setCode(this.code);
        data.setName(this.name);
        data.setValueUnit(this.valueUnit);
        data.setEnglishName(this.englishName);
        data.setUniformCode(this.uniformCode);
        data.setStationId(this.stationId);
        data.setDataType(this.dataType);
        data.setTypeId(this.typeId);
        return data;

    }
}
