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.PowerStationTestingPoint;
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.POWER_STATION_TESTING_POINT)
public class PowerStationTestingPointEntity implements ToData<PowerStationTestingPoint> {

    //编号
    @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;

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


    public PowerStationTestingPointEntity(PowerStationTestingPoint 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.category = point.getCategory();

    }

    @Override
    public PowerStationTestingPoint toData() {
        PowerStationTestingPoint data = new PowerStationTestingPoint();
        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.setCategory(this.category);
        return data;
    }
}
