package com.placeholder.sherpai2.data.local.entity

import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.Index

@Entity(
    tableName = "image_events",
    primaryKeys = ["imageId", "eventId"],
    foreignKeys = [
        ForeignKey(
            entity = ImageEntity::class,
            parentColumns = ["imageId"],
            childColumns = ["imageId"],
            onDelete = ForeignKey.CASCADE
        ),
        ForeignKey(
            entity = EventEntity::class,
            parentColumns = ["eventId"],
            childColumns = ["eventId"],
            onDelete = ForeignKey.CASCADE
        )
    ],
    indices = [
        Index("eventId")
    ]
)
data class ImageEventEntity(

    val imageId: String,
    val eventId: String,

    /**
     * AUTO | MANUAL
     */
    val source: String,

    /**
     * User override flag.
     */
    val override: Boolean
)
