package com.xydl.cac.entity;

import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.util.List;

@JsonInclude(JsonInclude.Include.NON_NULL)
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "modevtype")
@ApiModel("监测装置类型表")
public class ModevType {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    private Integer id;

    @NotBlank(message = "名称不能为空")
    @Size(max = 50, message = "名称长度不能超过50个字符")
    @Column(name = "mc")
    private String mc;

    @NotBlank(message = "表名不能为空")
    @Column(name = "tablename")
    private String tablename;

    @Column(name = "type_code")
    private String typeCode;

    @Column(name = "intervals")
    private Integer intervals;


    @Transient
    private long sensorCount;

    @Transient
    private List<I2syncField> i2syncFields;
}