/// <reference types="node" />
import { Resource } from '../../../entity';
import { ResourceType } from '../../../interface';
import { MagicProvide } from '../../magic.provide';
export declare type ImportMode = 'increment' | 'full';
interface MagicResourceStore {
    /**
     * 存储类型 数据库|文件
     */
    type: 'database' | 'file' | string;
    /**
     * 保存资源
     * @param resource
     */
    saveOrUpdate(resource: Resource): Promise<Resource>;
    /**
     * 根据id查询资源
     * @param id 资源id
     */
    findById(id: string): Promise<Resource | undefined>;
    /**
     * 根据分组id查询资源
     * @param type 资源类型
     * @param groupId 分组id
     * @param isFolder 是否文件夹
     */
    findByGroupId(type: string, groupId: string, isFolder?: boolean): Promise<Resource[]>;
    /**
     * 设置锁定解锁
     * @param id 资源id
     * @param fileLock 是否锁定
     */
    lock(id: string, fileLock: boolean): Promise<any>;
    /**
     * 删除资源
     * @param id 资源id
     */
    deleteById(id: string): Promise<any>;
    /**
     * 根据类型查询资源
     * @param type 资源类型
     * @param enabled 是否启用
     * @param isFolder 是否文件夹
     */
    findByType(type: ResourceType, enabled?: boolean, isFolder?: boolean): Promise<Resource[]>;
    /**
     * 获取映射路径
     * @param resource
     */
    getMappingPath(resource: Resource): Promise<string>;
    /**
     * 获取映射名称
     * @param resource
     */
    getMappingName(resource: Resource): Promise<string>;
    /**
     * 递归获取资源 树形
     * @param type 资源类型
     * @param groupId 分组id
     */
    getTreeByType(type: ResourceType, groupId?: string): Promise<(Resource & {
        children: Resource[];
    })[]>;
    /**
     * 导出资源
     * @param ids 资源ids
     */
    exportResource(ids: string[]): Promise<Resource[]>;
    /**
     * 导入资源
     * @param resources 资源列表
     * @param mode 导入模式
     */
    importResource(resources: Resource[], mode: ImportMode): Promise<void>;
    /**
     * 删除所有
     */
    deleteAll(): Promise<void>;
}
export declare class MagicResourceService implements MagicResourceStore, MagicProvide {
    private static _MAGIC_RESOURCE_STORES;
    private activeStore;
    private exportFileStore;
    private importFileStore;
    type: 'database' | 'file' | string;
    magicConfig: any;
    init(): Promise<void>;
    /**
     * 设置存储store
     * @private
     */
    private setActiveStore;
    /**
     * 注册store
     * @param store
     */
    static registerStore(store: MagicResourceStore): void;
    deleteById(id: string): Promise<Resource>;
    findByGroupId(type: string, groupId: string, isFolder?: boolean): Promise<Resource[]>;
    findById(id: string): Promise<Resource>;
    findByType(type: ResourceType, enabled?: boolean, isFolder?: boolean): Promise<Resource[]>;
    lock(id: string, fileLock: boolean): Promise<any>;
    saveOrUpdate(resource: Resource): Promise<Resource>;
    getMappingPath(resource: Resource): Promise<string>;
    getMappingName(resource: Resource): Promise<string>;
    getTreeByType(type: ResourceType, groupId?: string): Promise<(Resource & {
        children: Resource[];
    })[]>;
    exportResource(ids: string[]): Promise<Resource[]>;
    importResource(resources: Resource[], mode: ImportMode): Promise<void>;
    deleteAll(): Promise<void>;
    /**
     * 导出ZIP
     * @param ids 资源ID
     */
    exportResourceZip(ids: string[]): Promise<Buffer>;
    /**
     * 导入zip
     * @param zipFilePath 文件路径
     * @param mode 导入模式
     */
    importResourceZip(zipFilePath: string, mode: ImportMode): Promise<void>;
}
export {};
