/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bytesw.bytebot.model;

import java.time.LocalDateTime;
import javax.persistence.*;

import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.annotations.Type;
import org.hibernate.envers.Audited;

@Audited
@Entity
@Getter
@Setter
@ToString
@EqualsAndHashCode(of = "id")
@NoArgsConstructor
@Table(name = "AVB_QUESTION_FILE")
@NamedQuery(name = "QuestionFile.findByPK", query = "Select u from QuestionFile u where u.id = ?1")
public class QuestionFile {

    @Id
    @Column(name = "QUFI_ID")
    @SequenceGenerator(name = "AVB_QUESTION_FILE_GENERATOR", sequenceName = "AVB_QUESTION_FILE_SEQ", initialValue = 1, allocationSize = 1)
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "AVB_QUESTION_FILE_GENERATOR")
    private Long id;
    
    @Column(name = "QUFI_UUID", nullable = false)
    private String uuid;

    @Column(name = "QUFI_NAME", nullable = false)
    private String name;

    @Column(name = "QUFI_SIZE", nullable = false)
    private Long size;

    @Column(name = "QUFI_UDATE", columnDefinition = "TIMESTAMP")
    private LocalDateTime uploadDate;

    @Type(type="org.hibernate.type.BinaryType")
    @Basic(fetch = FetchType.LAZY)
    @Column(name = "QUFI_DATA", length= 100000, nullable = false)
    private byte[] data;
}
