package com.github.nullptroma.wallenc.domain.datatypes

import java.time.Instant
import java.util.UUID

enum class StorageSyncOperation {
    UPSERT,
    /** Soft-delete (корзина): на peer вызывается [IStorageAccessor.moveToTrash]. */
    TRASH,
    /** Жёсткое удаление файла с носителя. */
    DELETE,
}

data class StorageSyncRevision(
    val sequence: Long,
    val actorId: String,
    val createdAt: Instant,
)

data class StorageSyncJournalEntry(
    val path: String,
    val operation: StorageSyncOperation,
    val revision: StorageSyncRevision,
    val size: Long? = null,
    val originStorageUuid: UUID? = null,
)

data class StorageSyncLock(
    val holderId: String,
    val leaseUntil: Instant,
    val updatedAt: Instant,
)
