package com.jiayue.ipfcst.common.data.entity;

import com.jiayue.ipfcst.common.data.constant.enums.DataSourceEnum;
import lombok.Data;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;

/**
 * 协议数据点表
 *
 * @author 修唯xiuwei
 * @version 3.0
 */
@Data
@Entity
public class ProtocolSenderDataPoint {

    /**
     * 顺序号
     */
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO, generator = "myid")
    @GenericGenerator(name = "myid", strategy = "com.jiayue.ipfcst.common.data.entity.id.CustomIDGenerator")
    private Integer id;


    /**
     * 该点位是否是采集得到还是通过规则生成
     */
    @Column(length = 1)
    private DataSourceEnum dataSource;

    /**
     * 通道号
     */
    @Column(length = 32)
    private String tunnelId;

    /**
     * 通道协议中对应的顺序位
     */
    @Column(length = 7)
    private Integer protocolPointNo;


    /**
     * 通道协议中对应的数据类型
     */
    @Column(length = 9)
    @Enumerated(EnumType.STRING)
    private ProtocolDataType protocolPointType;


    /**
     * 该点位对应的采集数据点位  点表的id
     */
    @Column(length = 5)
    private Integer gatherPoint;


    /**
     * 协议点描述的预测数据属性
     */
    @OneToOne
    @JoinColumn(name = "forecastAttributeId",foreignKey = @ForeignKey(value = ConstraintMode.NO_CONSTRAINT))
    private ForecastForSendAttribute forecastForSendAttribute;


    /**
     * 倍率
     */
    @Column(precision = 10, scale = 4)
    private Double magnification = 1D;


    /**
     * 用于生成需要内部生成的属性的规则
     */
    @Column(length = 2000)
    private String generationRegulation;

    /**
     * 场站标识
     */
    @Column
    private String stationCode;

}
