/** * Messages and conversations types */ import { ChannelType } from './common.js'; /** * Conversation guest information */ export interface ConversationGuest { /** Guest name */ name: string; /** Guest email */ email?: string; /** Guest phone */ phone?: string; } /** * Conversation summary */ export interface Conversation { /** The conversation ID */ id: string; /** Channel type */ channel_type: ChannelType; /** Last message timestamp (ISO 8601) */ last_message_at: string; /** Guest information */ guest: ConversationGuest; /** Property title */ property_title?: string; /** Check-in date */ check_in_date?: string; /** Check-out date */ check_out_date?: string; } /** * Conversations query parameters */ export interface ConversationsQueryParams { /** Starting index */ offset?: number; /** Max results (max 100) */ limit?: number; } /** * Conversations response data */ export interface ConversationsData { /** List of conversations */ conversations: Conversation[]; } /** * Activity type */ export type ActivityType = 'inquiry' | 'reservation'; /** * Room type reference */ export interface RoomTypeReference { /** Room type ID */ id: number; /** Room type title */ title: string; } /** * Property reference in activity */ export interface ActivityProperty { /** Property ID */ id: number; /** Property title */ title: string; /** Cover image URL */ cover_url?: string | null; /** Room type */ room_type?: RoomTypeReference | null; } /** * Conversation activity */ export interface ConversationActivity { /** Activity type */ activity_type: ActivityType; /** Reservation code */ reservation_code?: string | null; /** Check-in date */ check_in_date?: string | null; /** Check-out date */ check_out_date?: string | null; /** Listing ID */ listing_id?: string | null; /** Property details */ property?: ActivityProperty | null; } /** * Message display type */ export type MessageDisplayType = | 'Text' | 'Box' | 'FileAttachment' | 'RequestToBook' | 'BsRequestBook' | 'SpecialOffer' | 'ReservationAlteration' | 'HouseLinkCard'; /** * Message sender role */ export type SenderRole = 'host' | 'guest'; /** * A document cited by HostGPT as a knowledge source */ export interface MessageSourceDoc { /** Title of the source document */ title?: string; /** Quoted text fragments from this source */ fragment?: string[]; /** Same as the parent source type */ source_type?: string; /** Internal id linking back to the underlying record */ link_id?: number; } /** * Knowledge sources cited by HostGPT for a message, grouped by type */ export interface MessageSource { /** Source group type (e.g. checkin_guide, automation_reply, host_knowledge) */ type?: string; /** Individual documents grouped under this source type */ docs?: MessageSourceDoc[]; } /** * Message */ export interface Message { /** Message ID */ id: string; /** Sender role */ sender_role: SenderRole; /** Display type */ display_type: MessageDisplayType; /** Text content */ content: string; /** Attachment (if any) */ attachment?: unknown | null; /** When the message was created (ISO 8601) */ created_at: string; /** Display name of the sender when known (operator name, `HostGPT`, or null) */ sender_name?: string | null; /** Knowledge sources cited by HostGPT to generate this message */ sources?: MessageSource[]; } /** * Conversation details */ export interface ConversationDetails { /** Conversation ID */ id: string; /** Channel type */ channel_type: ChannelType; /** Guest information */ guest: ConversationGuest; /** Activities */ activities: ConversationActivity[]; /** Notes */ note?: string; /** Messages */ messages: Message[]; } /** * Conversation details response data */ export interface ConversationDetailsData extends ConversationDetails {} /** * Send message parameters */ export interface SendMessageParams { /** Conversation ID */ conversation_id: string; /** Text message content */ message?: string; /** Base64 encoded JPEG image */ jpeg_base64?: string; } /** * Update conversation note parameters */ export interface UpdateConversationNoteParams { /** The id of the conversation */ conversation_id: string; /** The host-side private note; empty string or null clears it */ note: string | null; } /** * Update conversation note response data */ export interface UpdateConversationNoteData { /** The id of the conversation */ id: string; /** The current note value after the update (null when cleared) */ note: string | null; /** When the note was last updated (ISO 8601) */ updated_at?: string | null; }