package de.thpeetz.kontor.media.data;

import de.thpeetz.kontor.comics.data.Artist;
import de.thpeetz.kontor.comics.data.Comic;
import de.thpeetz.kontor.common.data.AbstractEntity;
import jakarta.persistence.*;
import jakarta.validation.constraints.NotNull;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
@Entity
@Table(indexes = {@Index(columnList = "media_file_id, media_actor_id") },
        uniqueConstraints = @UniqueConstraint(columnNames = {"media_file_id", "media_actor_id" })
)
public class MediaActorFile extends AbstractEntity {

    @ManyToOne
    @JoinColumn(name = "media_file_id")
    @NotNull
    private MediaFile media_file;

    @ManyToOne
    @JoinColumn(name = "media_actor_id")
    @NotNull
    private MediaActor media_actor;

    public String getTitle() {
        return media_file.getTitle();
    }
}
