joinLottery

fun joinLottery(lotteryId: String, entrantId: String, numberOfGuests: Int, onResult: (Boolean, String) -> Unit)

Registers an entrant for a lottery and adds their entry to the Firestore database.

Checks if registration is open, the entrant has already joined, and the waitlist has available space. Uses a Firestore transaction to prevent duplicate entries.

Parameters

lotteryId

The lotteryId of the lottery to join.

entrantId

The ID of the entrant joining the lottery.

numberOfGuests

The number of guests included in the registration.

onResult

Callback that returns true if registration was successful, false otherwise, along with a message describing the result.