import { type Db } from "@rudderhq/db";
import { type OrganizationWorkspaceFileDetail, type OrganizationWorkspaceFileList, type WorkspaceBackupRestoreResult, type WorkspaceBackupSummary, type WorkspaceBackupTriggerSource } from "@rudderhq/shared";
type WorkspaceBackupArtifactMigration = {
    backupId: string;
    orgId: string;
    from: string;
    to: string;
    movedArtifact: boolean;
    updatedArtifact: boolean;
};
type WorkspaceBackupArtifactMigrationSkip = {
    backupId: string;
    orgId: string;
    from: string;
    to: string;
    reason: string;
};
export type WorkspaceBackupDownload = {
    artifactRef: string;
    filename: string;
    contentType: "application/json";
    byteSize: number;
    archiveSha256: string | null;
    content: Buffer;
};
export type SparseWorkspaceRecoveryResult = {
    orgId: string;
    recovered: boolean;
    backupId: string | null;
    currentFileCount: number;
    backupFileCount: number;
    restoredFileCount: number;
    skippedConflictingFiles: string[];
    reason: string | null;
    error: string | null;
};
export declare function reconcileWorkspaceBackupArtifactStorage(db: Db, liveOrgIds: readonly string[]): Promise<{
    migrated: WorkspaceBackupArtifactMigration[];
    skipped: WorkspaceBackupArtifactMigrationSkip[];
}>;
export declare function workspaceBackupService(db: Db): {
    recoverSparseWorkspaceFromLatestBackup: (orgId: string) => Promise<SparseWorkspaceRecoveryResult>;
    list(orgId: string): Promise<WorkspaceBackupSummary[]>;
    create(input: {
        orgId: string;
        triggerSource?: WorkspaceBackupTriggerSource;
        createdByUserId?: string | null;
        restoredFromBackupId?: string | null;
        retentionDays?: number;
    }): Promise<WorkspaceBackupSummary>;
    listFiles(orgId: string, backupId: string, directoryPath?: string): Promise<OrganizationWorkspaceFileList>;
    readFile(orgId: string, backupId: string, filePath: string): Promise<OrganizationWorkspaceFileDetail>;
    getDownload(orgId: string, backupId: string): Promise<WorkspaceBackupDownload>;
    remove(orgId: string, backupId: string): Promise<WorkspaceBackupSummary>;
    pruneExpired(now?: Date): Promise<WorkspaceBackupSummary[]>;
    runScheduledBackups(input?: {
        now?: Date;
        intervalMs?: number;
        retentionDays?: number;
    }): Promise<{
        created: WorkspaceBackupSummary[];
        failed: WorkspaceBackupSummary[];
        deleted: WorkspaceBackupSummary[];
        sparseRecoveries: SparseWorkspaceRecoveryResult[];
        skipped: number;
        errors: Array<{
            orgId: string;
            message: string;
        }>;
    }>;
    restore(orgId: string, backupId: string, input?: {
        createdByUserId?: string | null;
    }): Promise<WorkspaceBackupRestoreResult>;
};
export {};
//# sourceMappingURL=workspace-backups.d.ts.map