/**
 * 存储服务统一导出
 * 
 * 提供平台级的文件存储能力，支持本地和云端无缝切换。
 * 
 * @module storage
 * 
 * @example
 * ```typescript
 * // 方式1：使用单例（推荐）
 * import { storage } from '@/common/storage'
 * const url = await storage.upload('literature/123.pdf', buffer)
 * 
 * // 方式2：直接使用适配器
 * import { LocalAdapter } from '@/common/storage'
 * const adapter = new LocalAdapter()
 * const url = await adapter.upload('literature/123.pdf', buffer)
 * 
 * // 方式3：使用工厂
 * import { StorageFactory } from '@/common/storage'
 * const storage = StorageFactory.getInstance()
 * const url = await storage.upload('literature/123.pdf', buffer)
 * ```
 */

export type { StorageAdapter } from './StorageAdapter.js'
export { LocalAdapter } from './LocalAdapter.js'
export { OSSAdapter } from './OSSAdapter.js'
export { StorageFactory } from './StorageFactory.js'

// Import for usage below
import { StorageFactory } from './StorageFactory.js'

/**
 * 全局存储实例（推荐使用）
 * 
 * 自动根据环境变量选择存储实现：
 * - STORAGE_TYPE=local: 本地文件系统
 * - STORAGE_TYPE=oss: 阿里云OSS
 */
export const storage = StorageFactory.getInstance()

