export interface UploadCompleteEvent {
	identifier: string;
	filename: string;
	size: number;
	hash: string;
	integrityVerified: boolean;
}

export type UploadEvent = {
	uploadStart: {
		identifier: string;
		filename: string;
		totalSize: number;
		resuming?: boolean;
	};
	uploadComplete: UploadCompleteEvent;
	uploadError: { identifier: string; error: string; filename: string };
};

export interface UploadLock {
	clientId: string;
	timestamp: number;
}

// 存储类型枚举
export enum StorageType {
	LOCAL = 'local',
	S3 = 's3',
}

// 存储配置接口
export interface StorageConfig {
	type: StorageType;
	// 本地存储配置
	local?: {
		directory: string;
		expirationPeriodInMilliseconds?: number;
	};
	// S3 存储配置
	s3?: {
		bucket: string;
		region: string;
		accessKeyId: string;
		secretAccessKey: string;
		endpoint?: string; // 用于兼容其他 S3 兼容服务
		forcePathStyle?: boolean;
		partSize?: number;
		maxConcurrentPartUploads?: number;
		expirationPeriodInMilliseconds?: number;
	};
}

// 资源数据接口
export interface ResourceData {
	id: string;
	fileId: string;
	title: string;
	type?: string | null;
	storageType: StorageType;
	status: string;
	meta?: any;
	createdAt: Date;
	updatedAt: Date;
}

// 创建资源数据接口
export interface CreateResourceData {
	fileId: string;
	filename: string;
	size: number;
	mimeType?: string | null;
	storageType: StorageType;
	status?: string;
	hash?: string;
}
