import { ConfigService } from '@nestjs/config';
import { PrismaService } from "../../../core/database/prisma/prisma.service";
import { DocAuthorityLevel, DocType } from '@prisma/client';
interface DriveItem {
    id: string;
    name: string;
    webUrl: string;
    eTag?: string;
    size?: number;
    file?: {
        mimeType?: string;
    };
    folder?: {
        childCount?: number;
    };
    createdDateTime?: string;
    lastModifiedDateTime?: string;
    createdBy?: {
        user?: {
            displayName?: string;
        };
    };
    lastModifiedBy?: {
        user?: {
            displayName?: string;
        };
    };
    parentReference?: {
        driveId?: string;
        siteId?: string;
        path?: string;
    };
    listItem?: {
        fields?: {
            DocAuthorityLevel?: string;
            DocLifecycleStatus?: string;
            DocType?: string;
        };
    };
}
type SharePointDownloadResult = {
    status: 'downloaded';
    filePath: string;
    hash: string;
    contentType: string | null;
} | {
    status: 'not_modified';
};
export interface SyncedSharePointDocument {
    item: DriveItem;
    record: {
        id: string;
        title: string;
        webUrl: string;
        fileExtension: string | null;
        docType: DocType;
        docAuthorityLevel: DocAuthorityLevel;
        spModifiedAt: Date | null;
        createdBy: string | null;
        spEtag: string | null;
        size: bigint | null;
    };
    previousMetadata: {
        spModifiedAt: Date | null;
        spEtag: string | null;
        size: bigint | null;
    } | null;
}
export declare class SharePointSyncService {
    private readonly configService;
    private readonly prisma;
    private readonly logger;
    private client;
    private siteId;
    private driveId;
    constructor(configService: ConfigService, prisma: PrismaService);
    syncAllMetadata(): Promise<{
        driveId: string;
        documents: SyncedSharePointDocument[];
        cursors: Array<{
            scopePath: string;
            deltaLink: string;
        }>;
    }>;
    syncDeltaMetadata(): Promise<{
        driveId: string;
        documents: SyncedSharePointDocument[];
        removedItemIds: string[];
        cursors: Array<{
            scopePath: string;
            deltaLink: string;
        }>;
    }>;
    shouldFallbackToFullSyncForDelta(): Promise<{
        shouldFallback: boolean;
        reason?: string;
    }>;
    saveDeltaCursors(driveId: string, cursors: Array<{
        scopePath: string;
        deltaLink: string;
    }>): Promise<void>;
    downloadItemToTemp(driveId: string, itemId: string, filename: string, expectedSize?: number, options?: {
        ifNoneMatch?: string | null;
        ifModifiedSince?: Date | null;
    }): Promise<SharePointDownloadResult>;
    private downloadFromUrl;
    private downloadFromGraph;
    private writeStreamToFile;
    private validateDownloadedFile;
    private safeCleanup;
    private syncFileItem;
    private syncFolderItem;
    private fetchAllDriveItems;
    private fetchDeltaItems;
    private buildDeltaStartUrl;
    private resolveFolderId;
    private encodeDrivePath;
    private isRemovedDeltaItem;
    private fetchFolderItems;
    private getIncludedPaths;
    private getItemPath;
    private normalizeSharePointPath;
    private shouldIncludeFile;
    private shouldTraverseFolder;
    private cleanupMissingDocuments;
    private cleanupMissingFolders;
    private cleanupRemovedFolders;
    private parseDocAuthorityLevel;
    private parseDocLifecycleStatus;
    private parseDocType;
    private getClient;
    private getSiteId;
    private getDriveId;
    private tryParseSiteUrl;
    private normalizeSitePath;
}
export {};
