package app.closer.domain.repository

import app.closer.crypto.RecoveryKeyManager
import app.closer.domain.model.Invite

data class CreateInviteResult(val code: String, val recoveryPhrase: String)

/**
 * Result of accepting an invite through the server-side callable.
 *
 * @property inviterUserId The UID of the partner who created the invite.
 * @property wrappedKey The encrypted couple key the acceptor must unwrap.
 */
data class AcceptInviteResult(
    val coupleId: String,
    val inviterUserId: String,
    val wrappedKey: RecoveryKeyManager.WrappedKey
)

interface InviteRepository {
    suspend fun createInvite(inviterUserId: String): Result<CreateInviteResult>
    suspend fun getInviteByCode(code: String): Result<Invite?>
    suspend fun acceptInvite(code: String, acceptorUserId: String, recoveryPhrase: String): Result<AcceptInviteResult>
}
