package com.syncflow.data.db.entities

import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.Index
import androidx.room.PrimaryKey
import com.syncflow.domain.model.SyncEventType
import java.time.Instant

@Entity(
    tableName = "sync_events",
    foreignKeys = [ForeignKey(
        entity = SyncPairEntity::class,
        parentColumns = ["id"],
        childColumns = ["syncPairId"],
        onDelete = ForeignKey.CASCADE,
    )],
    indices = [Index("syncPairId"), Index("timestamp")],
)
data class SyncEventEntity(
    @PrimaryKey(autoGenerate = true) val id: Long = 0,
    val syncPairId: Long,
    val timestamp: Instant,
    val eventType: SyncEventType,
    val filePath: String?,
    val message: String?,
    val bytesTransferred: Long,
)
