// ВАЖНО: пути и поля — предположение. Подставьте реальные эндпоинты бэкенда. import { api } from '@/api/client' // ваш axios-инстанс export type ReportType = 'call' | 'sms' | 'chat' export type Channel = 'telegram' | 'whatsapp' | 'max' export interface ReportRow { id: string type: ReportType channel?: Channel | null // только для type = 'chat' started_at: string // ISO; дата и время из таблицы одним полем direction: 'in' | 'out' phone: string contact_name?: string | null company?: string | null value: number // звонок — секунды, SMS/чат — число сообщений answered: boolean recording_url?: string | null // звонок last_message?: string | null // SMS / чат manager: string manager_id?: number | null status: string // «Отвечен», «Пропущен, перезвон не совершен», … } export interface ReportParams { offset?: number; limit?: number type?: ReportType; manager?: string; direction?: 'in' | 'out' status?: string; content?: string; date_from?: string; date_to?: string } export interface ChatMessage { id: string; direction: 'in' | 'out'; text: string; at: string; author?: string } export const telephonyApi = { list: (params: ReportParams) => api.get<{ data: ReportRow[]; total_count: number }>('/telephony/report', { params }).then((r) => r.data), messages: (id: string) => api.get<{ data: ChatMessage[] }>(`/telephony/report/${id}/messages`).then((r) => r.data.data), download: (params: ReportParams) => api.get('/telephony/report/xlsx', { params, responseType: 'blob' }).then((r) => r.data as BlobPart), }