package app.closer.domain.repository

import app.closer.crypto.RecoveryKeyManager

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.
 * @property recoveryPhrase The recovery phrase, decrypted client-side from the server's
 *   encryptedRecoveryPhrase blob using the invite code. Null for iOS-originated invites
 *   (encryptionVersion=0) until iOS implements E2EE parity.
 */
data class AcceptInviteResult(
    val coupleId: String,
    val inviterUserId: String,
    val wrappedKey: RecoveryKeyManager.WrappedKey,
    val recoveryPhrase: String?
)

interface InviteRepository {
    suspend fun createInvite(): Result<CreateInviteResult>
    suspend fun acceptInvite(code: String): Result<AcceptInviteResult>
    fun watchAccepted(code: String): kotlinx.coroutines.flow.Flow<String?>
}
