import { Prisma } from '../../../prisma-client';
import type { SelectedCalendarEventTypeIds } from "@calcom/types/Calendar";
export type UpdateArguments = {
    where: FindManyArgs["where"];
    data: Prisma.SelectedCalendarUpdateManyArgs["data"];
};
export type FindManyArgs = {
    where?: {
        userId?: number | {
            in: number[];
        };
        credentialId?: number | null;
        integration?: string;
        externalId?: string;
        eventTypeId?: number | null;
        googleChannelId?: string | null | {
            not: null;
        };
    };
    orderBy?: {
        userId?: "asc" | "desc";
    };
    select?: Prisma.SelectedCalendarSelect;
};
export declare class SelectedCalendarRepository {
    private static findConflicting;
    static findById(id: string): 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;
    } | null>;
    static create(data: Prisma.SelectedCalendarUncheckedCreateInput): 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;
    }>;
    static upsert(data: Prisma.SelectedCalendarUncheckedCreateInput): 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;
    }>;
    static delete({ where }: {
        where: Prisma.SelectedCalendarUncheckedCreateInput;
    }): 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;
    }>;
    static deleteById({ id }: {
        id: string;
    }): 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;
    }>;
    static createIfNotExists(data: Prisma.SelectedCalendarUncheckedCreateInput): 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;
    }>;
    /** Retrieve calendars that need to be watched */
    static getNextBatchToWatch(limit?: number): 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;
    }[]>;
    /**
     * Retrieve calendars that are being watched but shouldn't be anymore
     * e.g. when a user disables calendar cache for the organization
     */
    static getNextBatchToUnwatch(limit?: number): 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;
    }[]>;
    static findMany({ where, select, orderBy }: FindManyArgs): 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;
    }[]>;
    static findUniqueOrThrow({ where }: {
        where: Prisma.SelectedCalendarWhereInput;
    }): 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;
    }>;
    static findFirstByGoogleChannelId(googleChannelId: string): Promise<{
        credential: {
            key: Prisma.JsonValue;
            user: {
                email: string;
            } | null;
            id: number;
            type: string;
            userId: number | null;
            teamId: number | null;
            selectedCalendars: {
                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;
            }[];
            delegationCredentialId: string | null;
            appId: string | null;
            invalid: boolean | null;
        } | null;
    } | null>;
    static findFirst({ where }: {
        where: Prisma.SelectedCalendarWhereInput;
    }): 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;
    } | null>;
    static findFirstOrThrow({ where }: {
        where: Prisma.SelectedCalendarWhereInput;
    }): 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;
    }>;
    static update(args: UpdateArguments): 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;
    }>;
    /**
     * Following methods ensure that they operate on user level calendars only
     */
    static findUserLevelUniqueOrThrow({ where }: {
        where: Prisma.SelectedCalendarWhereInput;
    }): 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;
    }>;
    static findManyUserLevel(args: FindManyArgs): 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;
    }[]>;
    static updateUserLevel(args: UpdateArguments): 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;
    }>;
    static deleteUserLevel({ where }: {
        where: Prisma.SelectedCalendarUncheckedCreateInput;
    }): 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;
    }>;
    static upsertManyForEventTypeIds({ data, eventTypeIds, }: {
        data: Prisma.SelectedCalendarUncheckedCreateInput;
        eventTypeIds: SelectedCalendarEventTypeIds;
    }): 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;
    }[]>;
    static updateById(id: string, data: Prisma.SelectedCalendarUpdateInput): 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;
    }>;
    static setErrorInWatching({ id, error }: {
        id: string;
        error: string;
    }): Promise<void>;
    static setErrorInUnwatching({ id, error }: {
        id: string;
        error: string;
    }): Promise<void>;
    static removeWatchingError({ id }: {
        id: string;
    }): Promise<void>;
    static removeUnwatchingError({ id }: {
        id: string;
    }): Promise<void>;
}
//# sourceMappingURL=selectedCalendar.d.ts.map