export type EventCapacityTone = 'neutral' | 'warning' | 'danger' export function occupiedSeatCount(bookedCount: number, reservedCapacity: number): number { return bookedCount + reservedCapacity } export function remainingSeatCount(capacity: number, bookedCount: number, reservedCapacity = 0): number { return Math.max(0, capacity - occupiedSeatCount(bookedCount, reservedCapacity)) } export function isOccupancyFull(capacity: number, bookedCount: number, reservedCapacity = 0): boolean { return occupiedSeatCount(bookedCount, reservedCapacity) >= capacity } /** Badge tone from remaining / total: red <20%, orange <50%, otherwise gray. */ export function capacityToneFromRemaining(remaining: number, capacity: number): EventCapacityTone { if (capacity <= 0) return 'danger' const ratio = remaining / capacity if (ratio < 0.2) return 'danger' if (ratio < 0.5) return 'warning' return 'neutral' }