package app.closer.domain.repository

import app.closer.domain.model.Conversation
import app.closer.domain.model.QuestionMessage
import kotlinx.coroutines.flow.Flow

interface ConversationRepository {
    fun observeConversations(coupleId: String, currentUserId: String): Flow<List<Conversation>>
    suspend fun ensureMainConversation(coupleId: String)
    suspend fun ensureQuestionConversation(coupleId: String, questionId: String): String
    suspend fun markRead(coupleId: String, conversationId: String, userId: String)
    fun observeMessages(coupleId: String, conversationId: String, limit: Int): Flow<List<QuestionMessage>>
    fun observePartnerReadAt(coupleId: String, conversationId: String, currentUserId: String): Flow<Long>
    fun setTyping(coupleId: String, conversationId: String, userId: String, typing: Boolean)
    fun observePartnerTyping(coupleId: String, conversationId: String, currentUserId: String): Flow<Long>
    suspend fun sendMessage(coupleId: String, conversationId: String, userId: String, text: String)
    suspend fun sendImageMessage(coupleId: String, conversationId: String, userId: String, imageBytes: ByteArray)
    suspend fun sendVoiceMessage(coupleId: String, conversationId: String, userId: String, audioBytes: ByteArray, durationMs: Long)
    suspend fun setReaction(coupleId: String, conversationId: String, messageId: String, userId: String, emoji: String?)
    suspend fun deleteMessage(coupleId: String, conversationId: String, messageId: String)
    suspend fun loadDecryptedMedia(coupleId: String, mediaUrl: String): ByteArray?
}
