import type { calendar_v3 } from "@googleapis/calendar";
import type { Prisma } from '../../../prisma-client';
import type { FreeBusyArgs } from '../../../features/calendar-cache/calendar-cache.repository.interface';
import type { Calendar, CalendarServiceEvent, CalendarEvent, EventBusyDate, IntegrationCalendar, NewCalendarEventType } from "@calcom/types/Calendar";
import type { SelectedCalendarEventTypeIds } from "@calcom/types/Calendar";
import type { CredentialForCalendarServiceWithEmail } from "@calcom/types/Credential";
type GoogleChannelProps = {
    kind?: string | null;
    id?: string | null;
    resourceId?: string | null;
    resourceUri?: string | null;
    expiration?: string | null;
};
export default class GoogleCalendarService implements Calendar {
    private integrationName;
    private auth;
    private log;
    private credential;
    constructor(credential: CredentialForCalendarServiceWithEmail);
    getCredentialId(): number;
    authedCalendar(): Promise<calendar_v3.Calendar>;
    private getAttendees;
    private stopWatchingCalendarsInGoogle;
    private startWatchingCalendarsInGoogle;
    createEvent(calEvent: CalendarServiceEvent, credentialId: number, externalCalendarId?: string): Promise<NewCalendarEventType>;
    getFirstEventInRecurrence(recurringEventId: string | null | undefined, selectedCalendar: string, calendar: calendar_v3.Calendar): Promise<calendar_v3.Schema$Event>;
    updateEvent(uid: string, event: CalendarServiceEvent, externalCalendarId: string): Promise<any>;
    deleteEvent(uid: string, event: CalendarEvent, externalCalendarId?: string | null): Promise<void>;
    fetchAvailability(requestBody: FreeBusyArgs): Promise<calendar_v3.Schema$FreeBusyResponse>;
    getFreeBusyResult(args: FreeBusyArgs, shouldServeCache?: boolean): Promise<calendar_v3.Schema$FreeBusyResponse>;
    getValidCalendars<T extends {
        id?: string | null;
    }>(cals: T[]): (T & {
        id: string;
    })[];
    filterPrimaryCalendar(cals: calendar_v3.Schema$CalendarListEntry[]): calendar_v3.Schema$CalendarListEntry & {
        id: string;
    };
    getCacheOrFetchAvailability(args: FreeBusyArgs, shouldServeCache?: boolean): Promise<(EventBusyDate & {
        id: string;
    })[] | null>;
    getAvailabilityWithTimeZones(dateFrom: string, dateTo: string, selectedCalendars: IntegrationCalendar[], 
    /**
     * If true, we will fallback to the primary calendar if no valid selected calendars are found
     */
    fallbackToPrimary?: boolean): Promise<{
        start: Date | string;
        end: Date | string;
        timeZone: string;
    }[]>;
    getAvailability(dateFrom: string, dateTo: string, selectedCalendars: IntegrationCalendar[], shouldServeCache?: boolean, 
    /**
     * If true, we will fallback to the primary calendar if no valid selected calendars are found
     */
    fallbackToPrimary?: boolean): Promise<EventBusyDate[]>;
    listCalendars(): Promise<IntegrationCalendar[]>;
    testDelegationCredentialSetup(): Promise<boolean>;
    /**
     * calendarId is the externalId for the SelectedCalendar
     * It doesn't check if the subscription has expired or not.
     * It just creates a new subscription.
     */
    watchCalendar({ calendarId, eventTypeIds, }: {
        calendarId: string;
        eventTypeIds: SelectedCalendarEventTypeIds;
    }): Promise<GoogleChannelProps | undefined>;
    /**
     * GoogleChannel subscription is only stopped when all selectedCalendars are un-watched.
     */
    unwatchCalendar({ calendarId, eventTypeIds, }: {
        calendarId: string;
        eventTypeIds: SelectedCalendarEventTypeIds;
    }): Promise<void>;
    setAvailabilityInCache(args: FreeBusyArgs, data: calendar_v3.Schema$FreeBusyResponse): Promise<void>;
    fetchAvailabilityAndSetCache(selectedCalendars: IntegrationCalendar[]): Promise<void>;
    createSelectedCalendar(data: Omit<Prisma.SelectedCalendarUncheckedCreateInput, "integration" | "credentialId">): Promise<{
        error: string | null;
        id: string;
        userId: number;
        credentialId: number | null;
        eventTypeId: number | null;
        integration: string;
        externalId: string;
        delegationCredentialId: string | null;
        domainWideDelegationCredentialId: string | null;
        googleChannelId: string | null;
        googleChannelKind: string | null;
        googleChannelResourceId: string | null;
        googleChannelResourceUri: string | null;
        googleChannelExpiration: string | null;
        lastErrorAt: Date | null;
        watchAttempts: number;
        unwatchAttempts: number;
        maxAttempts: number;
    }>;
    upsertSelectedCalendar(data: Omit<Prisma.SelectedCalendarUncheckedCreateInput, "integration" | "credentialId" | "userId">): Promise<{
        error: string | null;
        id: string;
        userId: number;
        credentialId: number | null;
        eventTypeId: number | null;
        integration: string;
        externalId: string;
        delegationCredentialId: string | null;
        domainWideDelegationCredentialId: string | null;
        googleChannelId: string | null;
        googleChannelKind: string | null;
        googleChannelResourceId: string | null;
        googleChannelResourceUri: string | null;
        googleChannelExpiration: string | null;
        lastErrorAt: Date | null;
        watchAttempts: number;
        unwatchAttempts: number;
        maxAttempts: number;
    } | undefined>;
    upsertSelectedCalendarsForEventTypeIds(data: Omit<Prisma.SelectedCalendarUncheckedCreateInput, "integration" | "credentialId" | "userId">, eventTypeIds: SelectedCalendarEventTypeIds): Promise<void>;
    getAllCalendars(calendar: calendar_v3.Calendar, fields?: string[]): Promise<calendar_v3.Schema$CalendarListEntry[]>;
    getPrimaryCalendar(_calendar?: calendar_v3.Calendar): Promise<calendar_v3.Schema$Calendar | null>;
}
export {};
//# sourceMappingURL=CalendarService.d.ts.map