package com.syncflow.data.providers

import com.syncflow.domain.model.CloudAccount
import com.syncflow.domain.model.RemoteFile
import kotlinx.coroutines.flow.Flow
import java.io.InputStream
import java.io.OutputStream

interface CloudProvider {
    suspend fun testConnection(): Result<Unit>
    suspend fun listFiles(remotePath: String): Result<List<RemoteFile>>
    suspend fun uploadFile(
        localStream: InputStream,
        remotePath: String,
        sizeBytes: Long,
        onProgress: (bytesWritten: Long) -> Unit = {},
    ): Result<RemoteFile>
    suspend fun downloadFile(
        remotePath: String,
        destination: OutputStream,
        onProgress: (bytesRead: Long) -> Unit = {},
    ): Result<Unit>
    suspend fun deleteFile(remotePath: String): Result<Unit>
    suspend fun createDirectory(remotePath: String): Result<Unit>
    suspend fun getFileMetadata(remotePath: String): Result<RemoteFile>
    suspend fun moveFile(fromPath: String, toPath: String): Result<Unit>

    companion object {
        const val CHUNK_SIZE = 8 * 1024 * 1024L // 8 MB
    }
}
