package com.seven.ikar.kotlin.core.local

import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.Index

@Entity(
    tableName = "cached_chat_messages",
    primaryKeys = ["owner_user_id", "chat_id", "message_id"],
    indices = [
        Index(value = ["owner_user_id", "chat_id", "sent_at"]),
        Index(value = ["owner_user_id", "chat_id", "is_optimistic"])
    ]
)
data class CachedChatMessageEntity(
    @ColumnInfo(name = "owner_user_id")
    val ownerUserId: String,
    @ColumnInfo(name = "chat_id")
    val chatId: String,
    @ColumnInfo(name = "message_id")
    val messageId: String,
    @ColumnInfo(name = "sent_at")
    val sentAt: String,
    @ColumnInfo(name = "payload_json")
    val payloadJson: String,
    @ColumnInfo(name = "is_optimistic")
    val isOptimistic: Boolean
)
