package com.jiayue.ipfcst.dataexchange.domain;

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

import javax.persistence.*;
import java.util.List;

/**
 * 点位模版
 *
 * @author 修唯xiuwei
 * @version 3.0
 */
@Data
@Entity
public class EquipmentDataTemplate {


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

  /**
   * 模版名称
   */
  private String name;


  /**
   * 默认的通道ID
   */
  private String defaultTunnelId;


  /**
   * 模版类型
   */
  @Enumerated(EnumType.STRING)
  private EquipmentTypeEnum templateType;


  /**
   * 该模版所管理的点位  updatable =false 在修改模版时不会修改 templatePoint 内容
   */
  @OneToMany(fetch = FetchType.EAGER, cascade = {CascadeType.REMOVE})
  @JoinColumn(name = "equipmentDataTemplateId", updatable = false)
  private List<TemplatePoint> points;

  /**
   * 场站编码
   */
  @Column
  private String stationCode;

}



