Files
conference-room-booking-system/frontend/src/interfaces.ts
Cliff Hill 0ee9767859 More fixes.
Signed-off-by: Cliff Hill <xlorep@darkhelm.org>
2025-09-30 12:08:16 -04:00

146 lines
3.5 KiB
TypeScript

/**
* interfaces.ts
* Centralized TypeScript interfaces for frontend application.
* @module
*/
// ...no imports in this file...
/**
* Information about a calendar slot selection, used for booking forms and calendar interactions.
* @property start - Start time of the slot
* @property end - End time of the slot
* @property room_id - Optional room identifier
* @property allDay - True if the slot is an all-day event
* @property viewType - Calendar view type (e.g., week, day)
* @property selectedRoomId - Room ID selected for booking
*/
export interface SlotInfo {
start: Date;
end: Date;
room_id?: string | number;
allDay?: boolean;
viewType?: string;
selectedRoomId?: string | number;
}
/**
* Props for the CalendarView component.
* @property events - Array of booking events to display
* @property onEventClick - Handler for event click
* @property onSlotSelect - Handler for slot selection
* @property selectedRoomId - Currently selected room ID
* @property officeStartHour - Start hour for business hours
* @property officeEndHour - End hour for business hours
* @property initialDate - Initial date to display in calendar
*/
export interface CalendarViewProps {
events: import("./types").BookingEvent[];
onEventClick?: () => void;
onSlotSelect?: () => void;
selectedRoomId?: string | number;
officeStartHour?: number;
officeEndHour?: number;
initialDate?: string;
}
/**
* Props for the BookingForm component.
* @property open - Whether the form dialog is open
* @property onClose - Handler to close the form
* @property slotInfo - Slot information for booking
* @property rooms - List of available conference rooms
*/
export interface BookingFormProps {
open: boolean;
onClose: () => void;
slotInfo: SlotInfo;
rooms: ConferenceRoom[];
editBooking?: Booking;
allInvitees: string[];
onBookingSuccess?: () => void;
}
/**
* Invitee object for booking lists.
*/
export interface Invitee {
name?: string;
username?: string;
displayName?: string;
user?: { name?: string };
}
/**
* RoomListItemStyles for room list rendering.
*/
export interface RoomListItemStyles {
backgroundColor?: string;
fontWeight?: number;
color: string;
border?: string;
borderRadius?: number;
}
/**
* SSE payload for rooms availability stream.
*/
export interface RoomsAvailabilitySSEPayload {
bookings: Booking[];
// Add more specific properties if needed, otherwise remove index signature for strict typing
}
export interface User {
id: string | number;
name: string;
email?: string;
}
export interface Booking {
id: string;
room_id?: number | string;
room?: { name?: string };
start_time: string;
end_time: string;
start?: string | number | Date;
end?: string | number | Date;
title?: string;
invitees?: string[];
}
export interface ConferenceRoom {
id: number;
name: string;
location: string;
equipment: string;
capacity: number;
}
export interface BookingConfirmationProps {
booking: Booking & {
room?: { name?: string };
invitees?: string[];
start_time: string;
end_time: string;
title?: string;
};
onEdit: () => void;
onBack: () => void;
}
export interface RoomDetailsModalProps {
open: boolean;
onClose: () => void;
room: ConferenceRoom;
}
export interface BookingListProps {
bookings: Booking[];
/* eslint-disable-next-line no-unused-vars */
onSelect?: (booking: Booking) => void;
}
export interface RoomListProps {
rooms: ConferenceRoom[];
selectedRoomId?: number;
/* eslint-disable-next-line no-unused-vars */
onSelectRoom?: (roomId: number) => void;
}