package com.gestoreasy.database.dao

import androidx.room.*
import com.gestoreasy.database.entities.SyncLog
import kotlinx.coroutines.flow.Flow

@Dao
interface SyncLogDao {
    @Insert
    suspend fun insert(syncLog: SyncLog): Long
    
    @Query("SELECT * FROM sync_logs ORDER BY created_at DESC LIMIT :limit")
    suspend fun getRecent(limit: Int = 50): List<SyncLog>
    
    @Query("SELECT * FROM sync_logs WHERE tipo = :tipo ORDER BY created_at DESC")
    suspend fun getByType(tipo: String): List<SyncLog>
    
    @Query("SELECT * FROM sync_logs ORDER BY created_at DESC")
    fun getAllFlow(): Flow<List<SyncLog>>
}

