Lottery

data class Lottery(val lotteryId: String = "", val campsiteIds: List<String> = emptyList(), val ownerId: String = "", val registrationStart: Date = Date(), val registrationEnd: Date = Date(), val bookingStart: Date = Date(), val bookingEnd: Date = Date(), val numberOfWinners: Int = 1, val waitlistCapacity: Int = 1, val entryIds: List<String> = emptyList(), val status: LotteryStatus = LotteryStatus.OPEN)

Represents a lottery run by the campsite owner.

Constructors

Link copied to clipboard
constructor(lotteryId: String = "", campsiteIds: List<String> = emptyList(), ownerId: String = "", registrationStart: Date = Date(), registrationEnd: Date = Date(), bookingStart: Date = Date(), bookingEnd: Date = Date(), numberOfWinners: Int = 1, waitlistCapacity: Int = 1, entryIds: List<String> = emptyList(), status: LotteryStatus = LotteryStatus.OPEN)

Properties

Link copied to clipboard

The date when the booking period ends.

Link copied to clipboard

The date when winners can start booking.

Link copied to clipboard

IDs of the campsites included in this lottery. Must not be empty.

Link copied to clipboard

IDs of the WaitlistEntry objects currently in this lottery.

Link copied to clipboard

The unique ID of the lottery.

Link copied to clipboard

The amount of entries that will be drawn as winners.

Link copied to clipboard

The ID of the campsite owner who created the lottery.

Link copied to clipboard

The date when the waitlist stops accepting entrants.

Link copied to clipboard

The date when entrants can start joining the waitlist.

Link copied to clipboard

The current status of the lottery.

Link copied to clipboard

The maximum number of entries allowed on the waitlist.

Functions

Link copied to clipboard

Checks if the waitlist is full.

Link copied to clipboard
fun isRegistrationOpen(date: Date = Date()): Boolean

Checks if entrants can join the lottery at a specified date and time.