package de.thpeetz.kontor.media.data;

import de.thpeetz.kontor.common.data.AbstractEntity;
import jakarta.annotation.Nullable;
import jakarta.persistence.*;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;

import java.util.LinkedList;
import java.util.List;

@Slf4j
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
@Entity
public class MediaFile extends AbstractEntity {

    @Nullable
    private String url;

    private boolean review;

    private boolean shouldDownload;

    @Nullable
    private String title;

    @Nullable
    private String cloudLink;

    @Nullable
    private String fileName;

    @Nullable
    private String path;

    @OneToMany(fetch = FetchType.EAGER, mappedBy = "media_file", cascade = CascadeType.REFRESH, orphanRemoval = true)
    @Nullable
    List<MediaActorFile> mediaActorFiles = new LinkedList<>();
}
