import type { Department } from '../departments' import type { File } from '../files' // --- Shared types --- type InteractiveMessageButton = { type: 'reply' reply: { id: string; title: string } } type InteractiveMessageBodyFooter = string | { text: string } // --- Response types --- type InteractiveMedia = { id?: string link?: string filename?: string } type InteractiveMessageRow = { id: string title: string description?: string } type InteractiveMessageSection = { title: string rows: InteractiveMessageRow[] } type ListInteractiveMessageContent = { type: 'list' header?: { type: 'text' text?: string | { body: string } } body: InteractiveMessageBodyFooter footer?: InteractiveMessageBodyFooter action: { /** Label for the list trigger button. */ button: string sections: InteractiveMessageSection[] } } type ButtonInteractiveMessageContent = { type: 'button' header?: { type: 'text' | 'document' | 'image' | 'video' text?: string | { body: string } document?: InteractiveMedia image?: InteractiveMedia video?: InteractiveMedia } body: InteractiveMessageBodyFooter footer?: InteractiveMessageBodyFooter action: { buttons: InteractiveMessageButton[] } } export type InteractiveMessageContent = | ListInteractiveMessageContent | ButtonInteractiveMessageContent // --- Input types (create/update) --- type ListInteractiveMessageContentInput = { type: 'list' header?: { type: 'text' text?: string } body: InteractiveMessageBodyFooter footer?: InteractiveMessageBodyFooter action: { button: string sections: InteractiveMessageSection[] } } type ButtonInteractiveMessageContentInput = { type: 'button' header?: { type: 'text'; text?: string } | { type: 'image' | 'document' | 'video' } body: InteractiveMessageBodyFooter footer?: InteractiveMessageBodyFooter action: { buttons: InteractiveMessageButton[] } } type InteractiveMessageContentInput = | ListInteractiveMessageContentInput | ButtonInteractiveMessageContentInput type InteractiveMessageFilePayload = | { id: string } | { fileName: string; base64Url: string; mimetype: string } // --- Resource types --- export type InteractiveMessage = { id: string name: string type: 'list' | 'button' interactive: InteractiveMessageContent archivedAt: string | null accountId: string createdAt: string updatedAt: string deletedAt: string | null // relationships file?: File | null departments?: Department[] } export type InteractiveMessageRelationships = 'file' | 'departments' export type CreateInteractiveMessagePayload = { name: string interactive: InteractiveMessageContentInput departmentIds?: string[] departments?: { id: string }[] file?: InteractiveMessageFilePayload } export type UpdateInteractiveMessagePayload = { name?: string interactive?: InteractiveMessageContentInput departmentIds?: string[] departments?: { id: string }[] file?: InteractiveMessageFilePayload }