import type { Db } from "@rudderhq/db";
import { calendarEvents } from "@rudderhq/db";
import type { CalendarEvent, GoogleCalendarOAuthConfig, CalendarSource, CreateCalendarEvent, CreateCalendarSource, UpdateGoogleCalendarOAuthConfig, UpdateCalendarEvent, UpdateCalendarSource } from "@rudderhq/shared";
type Actor = {
    userId?: string | null;
};
export interface CalendarEventFilters {
    start: Date;
    end: Date;
    agentIds?: string[];
    sourceIds?: string[];
    eventKinds?: string[];
    statuses?: string[];
}
declare function eventSummary(event: Pick<typeof calendarEvents.$inferSelect, "title" | "eventKind" | "eventStatus" | "startAt" | "endAt" | "ownerAgentId" | "issueId">): {
    title: string;
    eventKind: string;
    eventStatus: string;
    startAt: string;
    endAt: string;
    ownerAgentId: string | null;
    issueId: string | null;
};
export declare function calendarService(db: Db): {
    eventSummary: typeof eventSummary;
    listSources(orgId: string): Promise<CalendarSource[]>;
    createSource(orgId: string, input: CreateCalendarSource, actor?: Actor): Promise<CalendarSource>;
    updateSource(orgId: string, sourceId: string, input: UpdateCalendarSource, actor?: Actor): Promise<CalendarSource>;
    deleteSource(orgId: string, sourceId: string): Promise<{
        ok: true;
    }>;
    listEvents(orgId: string, filters: CalendarEventFilters): Promise<CalendarEvent[]>;
    getEvent(orgId: string, eventId: string): Promise<CalendarEvent | null>;
    createEvent(orgId: string, input: CreateCalendarEvent, actor?: Actor): Promise<CalendarEvent | null>;
    updateEvent(orgId: string, eventId: string, input: UpdateCalendarEvent, actor?: Actor): Promise<{
        previous: {
            createdAt: Date;
            id: string;
            description: string | null;
            updatedAt: Date;
            orgId: string;
            title: string;
            issueId: string | null;
            projectId: string | null;
            goalId: string | null;
            heartbeatRunId: string | null;
            createdByUserId: string | null;
            ownerAgentId: string | null;
            visibility: string;
            approvalId: string | null;
            eventKind: string;
            updatedByUserId: string | null;
            sourceId: string | null;
            timezone: string;
            ownerType: string;
            ownerUserId: string | null;
            externalProvider: string | null;
            externalCalendarId: string | null;
            eventStatus: string;
            startAt: Date;
            endAt: Date;
            allDay: boolean;
            activityId: string | null;
            sourceMode: string;
            externalEventId: string | null;
            externalEtag: string | null;
            externalUpdatedAt: Date | null;
            deletedAt: Date | null;
        };
        event: CalendarEvent | null;
    }>;
    deleteEvent(orgId: string, eventId: string, actor?: Actor): Promise<{
        createdAt: Date;
        id: string;
        description: string | null;
        updatedAt: Date;
        orgId: string;
        title: string;
        issueId: string | null;
        projectId: string | null;
        goalId: string | null;
        heartbeatRunId: string | null;
        createdByUserId: string | null;
        ownerAgentId: string | null;
        visibility: string;
        approvalId: string | null;
        eventKind: string;
        updatedByUserId: string | null;
        sourceId: string | null;
        timezone: string;
        ownerType: string;
        ownerUserId: string | null;
        externalProvider: string | null;
        externalCalendarId: string | null;
        eventStatus: string;
        startAt: Date;
        endAt: Date;
        allDay: boolean;
        activityId: string | null;
        sourceMode: string;
        externalEventId: string | null;
        externalEtag: string | null;
        externalUpdatedAt: Date | null;
        deletedAt: Date | null;
    }>;
    getGoogleOAuthConfig: (orgId: string, redirectUri: string) => Promise<GoogleCalendarOAuthConfig>;
    updateGoogleOAuthConfig: (orgId: string, input: UpdateGoogleCalendarOAuthConfig, redirectUri: string, actor?: Actor) => Promise<GoogleCalendarOAuthConfig>;
    connectGoogle(orgId: string, redirectUri: string, actor?: Actor): Promise<{
        status: "configuration_required";
        authUrl: null;
        source: CalendarSource;
        redirectUri: string;
        requiredEnv: ("GOOGLE_CALENDAR_CLIENT_ID" | "GOOGLE_CALENDAR_CLIENT_SECRET")[];
        acceptedAliases: ("GOOGLE_CLIENT_ID" | "GOOGLE_CLIENT_SECRET")[];
        config: GoogleCalendarOAuthConfig;
    } | {
        status: "authorization_required";
        authUrl: string;
        source: CalendarSource;
        config: GoogleCalendarOAuthConfig;
        redirectUri?: undefined;
        requiredEnv?: undefined;
        acceptedAliases?: undefined;
    }>;
    completeGoogleCallback(orgId: string, input: {
        code: string;
        state?: string | null;
        redirectUri: string;
    }, actor?: Actor): Promise<CalendarSource>;
    syncGoogle(orgId: string, sourceId?: string | null): Promise<{
        source: CalendarSource;
        importedCount: number;
        syncedSourceCount: number;
    }>;
};
export {};
//# sourceMappingURL=calendar.d.ts.map