package org.mercury_im.messenger.data.model;

import io.requery.CascadeAction;
import io.requery.Entity;
import io.requery.ForeignKey;
import io.requery.Generated;
import io.requery.Key;
import io.requery.ManyToOne;
import io.requery.ReferentialAction;
import io.requery.Table;

@Entity
@Table(name = "direct_messages")
public abstract class AbstractDirectMessagesRelation {

    @Key @Generated
    long id;

    @ManyToOne(cascade = {CascadeAction.SAVE})
    @ForeignKey(referencedColumn = "id", delete = ReferentialAction.CASCADE)
    DirectChatModel chat;

    @ManyToOne(cascade = {CascadeAction.SAVE, CascadeAction.DELETE})
    @ForeignKey(referencedColumn = "id", delete = ReferentialAction.CASCADE)
    MessageModel message;
}
