import { Readable } from 'stream';
import { StorageService } from '../../../integrations/storage/storage.service';
import { MultipartFile } from '@fastify/multipart';
import { PreparedFile } from '../attachment.utils';
import { AttachmentRepo } from "../../../database/repos/attachment/attachment.repo";
import { AttachmentType } from '../attachment.constants';
import { KyselyDB, KyselyTransaction } from "../../../database/types/kysely.types";
import { Attachment, User, Workspace } from "../../../database/types/entity.types";
import { UserRepo } from "../../../database/repos/user/user.repo";
import { WorkspaceRepo } from "../../../database/repos/workspace/workspace.repo";
import { SpaceRepo } from "../../../database/repos/space/space.repo";
import { Queue } from 'bullmq';
import { PageRepo } from "../../../database/repos/page/page.repo";
export declare class AttachmentService {
    private readonly storageService;
    private readonly attachmentRepo;
    private readonly userRepo;
    private readonly workspaceRepo;
    private readonly spaceRepo;
    private readonly db;
    private attachmentQueue;
    private readonly pageRepo;
    private readonly logger;
    constructor(storageService: StorageService, attachmentRepo: AttachmentRepo, userRepo: UserRepo, workspaceRepo: WorkspaceRepo, spaceRepo: SpaceRepo, db: KyselyDB, attachmentQueue: Queue, pageRepo: PageRepo);
    uploadFile(opts: {
        filePromise: Promise<MultipartFile>;
        pageId?: string;
        templateId?: string;
        userId: string;
        spaceId: string;
        workspaceId: string;
        attachmentId?: string;
        type?: AttachmentType.File | AttachmentType.PageCover;
    }): Promise<{
        type: string;
        id: string;
        workspaceId: string;
        creatorId: string;
        createdAt: Date;
        updatedAt: Date;
        deletedAt: Date;
        tsv: string;
        spaceId: string;
        textContent: string;
        pageId: string;
        aiChatId: string;
        fileExt: string;
        fileName: string;
        filePath: string;
        fileSize: string;
        indexedAt: Date;
        mimeType: string;
        templateId: string;
    }>;
    uploadImage(filePromise: Promise<MultipartFile>, type: AttachmentType.Avatar | AttachmentType.WorkspaceIcon | AttachmentType.SpaceIcon, userId: string, workspaceId: string, spaceId?: string): Promise<{
        type: string;
        id: string;
        workspaceId: string;
        creatorId: string;
        createdAt: Date;
        updatedAt: Date;
        deletedAt: Date;
        tsv: string;
        spaceId: string;
        textContent: string;
        pageId: string;
        aiChatId: string;
        fileExt: string;
        fileName: string;
        filePath: string;
        fileSize: string;
        indexedAt: Date;
        mimeType: string;
        templateId: string;
    }>;
    deleteRedundantFile(filePath: string): Promise<void>;
    deleteAttachment(attachment: Attachment): Promise<void>;
    uploadToDrive(filePath: string, fileContent: Buffer | Readable): Promise<void>;
    saveAttachment(opts: {
        attachmentId?: string;
        preparedFile: PreparedFile;
        filePath: string;
        type: AttachmentType;
        userId: string;
        workspaceId: string;
        pageId?: string;
        templateId?: string;
        spaceId?: string;
        trx?: KyselyTransaction;
    }): Promise<Attachment>;
    handleDeleteAiChatAttachments(aiChatId: string): Promise<void>;
    handleDeleteTemplateAttachments(templateId: string): Promise<void>;
    copyAttachmentsToPage(attachments: Attachment[], idMap: Map<string, string>, page: {
        id: string;
        spaceId: string;
    }, creatorId: string): Promise<void>;
    private queueIndexContent;
    handleDeleteSpaceAttachments(spaceId: string): Promise<void>;
    handleDeleteUserAvatars(userId: string): Promise<void>;
    handleDeleteUnusedCover(opts: {
        pageId: string;
        attachmentId: string;
    }): Promise<void>;
    handleDeletePageAttachments(pageId: string): Promise<void>;
    removeUserAvatar(user: User): Promise<void>;
    removeSpaceIcon(spaceId: string, workspaceId: string): Promise<void>;
    removeWorkspaceIcon(workspace: Workspace): Promise<void>;
}
