/** Supported Elasticsearch indexes for contact history queries. */ type ContactHistoryIndex = 'chat' | 'cdr'; /** Sort order for contact history results. */ type ContactHistorySortOrder = 'asc' | 'desc'; /** Query parameters for listing contact interaction history across indexes. */ interface ListContactHistoryRequest { companyId?: string; contactIds?: string[]; indexes?: ContactHistoryIndex[]; operatorIds?: string[]; chatStatus?: string[]; chatProviders?: string[]; currentScore?: number; searchAfter?: string[]; queueIds?: string[]; order?: ContactHistorySortOrder; limit?: number; } /** Member associated with a contact interaction. */ interface InteractionMemberResponse { id: number; recipientId: string; provider: string; chatRoomId: number; origin: string; channel: string; companyId: string; } /** Chat routing step recorded for a contact interaction. */ interface InteractionChatStepResponse { id: string; chatRoomId: number; duration: number; actionId: string; queueId: unknown; nextQueueId: unknown; wasTransferred: unknown; createdAt: string; updatedAt: string; } /** Organization linked to a contact interaction. */ interface InteractionOrganizationResponse { id: number; callId: number; organizationId: number; createdAt: string; updatedAt: string; } /** Call step recorded for a contact interaction. */ interface InteractionCallStepResponse { id: number; callId: number; companyId: string; status: string; fromNumber: string; fromId: string; contextId: string; toNumber: string; toId: string; transferToNumber: unknown; transferToId: unknown; waitTime: number; talkTime: number; queue: unknown; createdAt: string; updatedAt: string; hourlyTalkTime: unknown[]; hourlyWaitTime: unknown[]; } /** Contact interaction entry returned by the Call Report API. */ interface ContactInteractionResponse { id: number; status?: string; companyId: string; currentAttendanceGroupId: unknown; answeredAt?: string; createdAt: string; updatedAt: string; waitTime?: number; wasTransferred: unknown; type: string; wasFinishedSilently?: boolean; totalTime?: number; attendanceTime?: number; campaignId: unknown; chatConfigId?: string; protocol: string; score: unknown; csatFeedback?: string | null; createdBy?: string; clientIdentifier?: string; closedBy: unknown; creatorProvider?: string; subject?: string; routedAt: unknown; activeDates: unknown; activeWeekDays: unknown; members?: InteractionMemberResponse[]; tags: unknown[]; tagsGroups: unknown[]; invitations?: unknown[]; chatSteps?: InteractionChatStepResponse[]; organizations: InteractionOrganizationResponse[]; _index: string; linkedId?: string; callId?: string; csatScore: unknown; hungUpByAgent?: boolean; sentToCsat?: boolean; hungupAt?: string; elasticId?: string; widgetId: unknown; wasCalledback: unknown; hasCallback: unknown; totalWaitTime?: number; totalTalkTime?: number; totalDuration?: number; steps?: InteractionCallStepResponse[]; } /** Paginated response returned by the Call Report API for multi-index history. */ interface ContactHistoryResponse { currentScore: string[]; data: ContactInteractionResponse[]; } /** Query parameters for fetching company telephony usage. */ interface CallReportCompanyUsageRequest { createdGte?: string; createdLte?: string; } /** Telephony usage totals split by inbound and outbound entries in the Call Report API. */ interface CallReportTelephonyUsageEntryResponse { inbound: number; outbound: number; } /** Provider usage totals for telephony calls in the Call Report API. */ interface CallReportTelephonyUsageProvidersResponse { phone: number; yunique: number; } /** Telephony usage totals returned by the Call Report API. */ interface CallReportTelephonyUsageResponse { internal: number; total: number; entry: CallReportTelephonyUsageEntryResponse; providers: CallReportTelephonyUsageProvidersResponse; } /** Company usage response returned by the Call Report API. */ interface CallReportCompanyUsageResponse { data: { telephony: CallReportTelephonyUsageResponse; }; } export type { CallReportCompanyUsageRequest, CallReportCompanyUsageResponse, CallReportTelephonyUsageEntryResponse, CallReportTelephonyUsageProvidersResponse, CallReportTelephonyUsageResponse, ContactHistoryIndex, ContactHistoryResponse, ContactHistorySortOrder, ContactInteractionResponse, InteractionCallStepResponse, InteractionChatStepResponse, InteractionMemberResponse, InteractionOrganizationResponse, ListContactHistoryRequest };