import type { Db } from "@rudderhq/db";
import { type MessengerApprovalThreadItem, type MessengerBudgetThreadItem, type MessengerHeartbeatRunThreadItem, type MessengerIssueThreadItem, type MessengerJoinRequestThreadItem, type MessengerSystemThreadKind, type MessengerThreadSummary } from "@rudderhq/shared";
import { chatService } from "./chats.js";
type ThreadReadState = {
    lastReadAt: Date;
};
type ChatConversationRow = Awaited<ReturnType<ReturnType<typeof chatService>["list"]>>[number];
type ChatMessageRow = Awaited<ReturnType<ReturnType<typeof chatService>["listMessages"]>>[number];
export declare function messengerService(db: Db): {
    listThreadSummaries: (orgId: string, userId: string) => Promise<MessengerThreadSummary[]>;
    getChatThread: (conversationId: string, userId: string) => Promise<{
        conversation: ChatConversationRow;
        messages: ChatMessageRow[];
    } | null>;
    getIssuesThread: (orgId: string, userId: string) => Promise<{
        summary: MessengerThreadSummary;
        detail: {
            threadKey: string;
            kind: "issues";
            title: string;
            subtitle: string;
            preview: string | null;
            latestActivityAt: Date | null;
            lastReadAt: Date | null;
            unreadCount: number;
            needsAttention: boolean;
            isPinned: false;
            href: string;
            description: string;
            items: MessengerIssueThreadItem[];
        };
    }>;
    getApprovalsThread: (orgId: string, userId: string) => Promise<{
        summary: MessengerThreadSummary;
        detail: {
            threadKey: string;
            kind: "approvals";
            title: string;
            subtitle: string;
            preview: string | null;
            latestActivityAt: Date;
            lastReadAt: Date | null;
            unreadCount: number;
            needsAttention: boolean;
            isPinned: false;
            href: string;
            description: string;
            items: MessengerApprovalThreadItem[];
        };
    }>;
    getSystemThread: (orgId: string, userId: string, threadKind: MessengerSystemThreadKind) => Promise<{
        summary: MessengerThreadSummary;
        detail: {
            threadKey: string;
            kind: "failed-runs";
            title: string;
            subtitle: string;
            preview: string | null;
            latestActivityAt: Date;
            lastReadAt: Date | null;
            unreadCount: number;
            needsAttention: boolean;
            isPinned: false;
            href: string;
            description: string;
            items: MessengerHeartbeatRunThreadItem[];
        };
    } | {
        summary: MessengerThreadSummary;
        detail: {
            threadKey: string;
            kind: "budget-alerts";
            title: string;
            subtitle: string;
            preview: string | null;
            latestActivityAt: Date;
            lastReadAt: Date | null;
            unreadCount: number;
            needsAttention: boolean;
            isPinned: false;
            href: string;
            description: string;
            items: MessengerBudgetThreadItem[];
        };
    } | {
        summary: MessengerThreadSummary;
        detail: {
            threadKey: string;
            kind: "join-requests";
            title: string;
            subtitle: string;
            preview: string | null;
            latestActivityAt: Date;
            lastReadAt: Date | null;
            unreadCount: number;
            needsAttention: boolean;
            isPinned: false;
            href: string;
            description: string;
            items: MessengerJoinRequestThreadItem[];
        };
    } | null>;
    getThreadState: (orgId: string, userId: string, threadKey: string) => Promise<{
        createdAt: Date;
        id: string;
        userId: string;
        updatedAt: Date;
        orgId: string;
        lastReadAt: Date;
        threadKey: string;
    }>;
    markThreadRead: (orgId: string, userId: string, threadKey: string, readAt?: Date) => Promise<ThreadReadState | null>;
    setThreadRead: (orgId: string, userId: string, threadKey: string, readAt?: Date) => Promise<ThreadReadState | null>;
};
export {};
//# sourceMappingURL=messenger.d.ts.map