package cn.wise.sc.energy.power.plant.business.domain;

import com.vladmihalcea.hibernate.type.json.JsonStringType;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.Type;
import org.hibernate.annotations.TypeDef;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
import java.util.List;

/**
 * @author neo.shu
 * @since 2020/9/10 18:29
 */
@Entity
@Data
@NoArgsConstructor
@Table(name = "caseanalysisinfo")
@TypeDef(name = "json", typeClass = JsonStringType.class)
public class CaseAnalysisInfo extends AbstractEntity<String>{
    @Id
    @Column(name = "case_id")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private String caseId;

    @Column(name = "plant_id")
    private String plantId;

    @Column(name = "title")
    private String title;

    @Column(name = "info")
    private String info;

    @Column(name = "keywords",columnDefinition = "json")
    @Type(type = "json")
    private List<String> keywords;

    @Column(name = "attachments",columnDefinition = "json")
    @Type(type = "json")
    private List<CaseAttachment> attachments;


    @Column(name = "create_time")
    private LocalDateTime createTime = LocalDateTime.now();

    @Column(name="update_time")
    private LocalDateTime updateTime = LocalDateTime.now();

    @Column(name="valid")
    private short valid=0;

    @Column(name="user_name")
    private String  username;



    @Override
    public String getId() {
        return getCaseId();
    }


}
