package com.github.nullptroma.wallenc.domain.interfaces

import com.github.nullptroma.wallenc.domain.tasks.TaskProgressLabel
import java.util.UUID

enum class StorageSyncGroupEncryptionKind {
    UNSET,
    NONE,
    PASSWORD,
}

data class StorageSyncGroup(
    val id: String,
    val storageUuids: Set<UUID>,
    val encryptionKind: StorageSyncGroupEncryptionKind = StorageSyncGroupEncryptionKind.UNSET,
    /** Локально сохранённый секрет группы для сопоставления совместимости (не уходит наружу). */
    val encryptionSecret: String? = null,
)

interface IStorageSyncGroupStore {
    suspend fun getGroups(): List<StorageSyncGroup>
    suspend fun putGroup(group: StorageSyncGroup)
    suspend fun removeGroup(groupId: String)
}

interface IStorageSyncEngine {
    suspend fun syncAllGroups(
        reportProgress: (suspend (fraction: Float?, label: TaskProgressLabel?) -> Unit)? = null,
    )
    suspend fun syncGroup(
        groupId: String,
        reportProgress: (suspend (fraction: Float?, label: TaskProgressLabel?) -> Unit)? = null,
    )
}
