package com.izouma.wenlvju.domain;

import com.izouma.wenlvju.converter.FileObjectListConverter;
import com.izouma.wenlvju.enums.AnnouncementType;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.Where;

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


@Data
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Builder
@Where(clause = "del = 0")
public class Announcement extends BaseEntity {
    private String title;

    @Enumerated(EnumType.STRING)
    private AnnouncementType type;

    @Column(columnDefinition = "TEXT")
    private String content;

    @Convert(converter = FileObjectListConverter.class)
    @Column(columnDefinition = "TEXT")
    private List<FileObject> annexes;
}
