/* eslint-disable @typescript-eslint/no-explicit-any */ export interface ChatWindowProps { userId: string; } /** * The other side of a conversation, as the conversations endpoint returns it. * Only `_id` is guaranteed; the rest vary by endpoint and account type. */ export interface ChatParticipant { _id: string; name?: string; profilePicture?: string; /** Legacy field names, still present on some older payloads. */ username?: string; profilePic?: string; acctype?: string; contactno?: string; country?: string; email?: string; verified?: string; createdAt?: string; updatedAt?: string; } /** @deprecated Use ChatParticipant. */ export type ParticipantDetails = ChatParticipant; export interface Conversation { _id: string; createdAt: string; lastMessage: { _id: string; senderId: string; message: string; media: string[]; type?: 'user' | 'system' | 'system-completion'; status: MessageStatus; chatId: string; createdAt: string; updatedAt: string; __v: number; }; updatedAt: string; __v: number; participantDetails: ChatParticipant[]; participants?: string[]; // readReceipts?: string[] | []; unreadMessageIds: string[]; type?: string | undefined; bookingId?: string; serviceId?: string; unreadMessageCount?: number serviceTitle?: string; } export interface ServiceConversationGroup { serviceId: string; serviceTitle: string; conversations: Conversation[]; } export interface ParticipantGroup { participantDetails: ParticipantDetails; personalConversation: Conversation | null; serviceConversations: ServiceConversationGroup[]; } export interface ApiResponse { success: boolean; message: string; serviceInfo: ParticipantGroup[]; } export interface ConversationProps { conversation: Conversation; lastIdx: boolean; } export type MessageStatus = 'sent' | 'delivered' | 'read' | 'sending' | 'failed' | 'edited' | 'deleted'; /* --------------------------------------------------------------------------- * Booking detail panel * * The chat API supplies bookingId/serviceTitle on conversations and a booking * summary on system messages, but not totals, payment breakdown, or history. * The host app fills those in via ; the panel renders * whatever it has and omits the rest. * ------------------------------------------------------------------------- */ export type BookingStatus = | 'pending' | 'confirmed' | 'rescheduled' | 'in-progress' | 'completed' | 'cancelled'; export interface BookingField { label: string; value: string; } export interface Booking { /** Appointment id, rendered in monospace. */ id: string; /** Accepts API PascalCase ("InProgress") or token case ("in-progress"). */ status?: string; customer?: string; service?: string; /** Pre-formatted for display, e.g. "Tue, 12 Aug". */ date?: string; /** Pre-formatted range, e.g. "09:00 - 11:30". */ time?: string; /** Pre-formatted currency string, e.g. "$180.00". */ total?: string; paymentDetails?: BookingField[]; history?: BookingField[]; /** Shows the Accept/Cancel footer. Defaults to true while pending. */ actionable?: boolean; }