// Canvas Tool 相关类型定义

export type NodeType = 
  | 'textInput' | 'imageUpload' | 'folderUpload'           // 输入节点
  | 'promptOptimize' | 'imageGenerate' | 'imageEdit' | 'videoGenerate'  // 处理节点
  | 'textDisplay' | 'imageDisplay' | 'videoPlayer' | 'batchGrid';       // 输出节点

export type DataType = 'text' | 'image' | 'video' | 'batch';

export type ProcessingStatus = 'idle' | 'loading' | 'success' | 'error';

export interface NodePort {
  id: string;
  type: DataType;
  label: string;
  position: 'input' | 'output';
}

export interface DataFlow {
  type: 'single' | 'batch';
  dataType: DataType;
  content: any;
  metadata?: {
    filename?: string;
    size?: number;
    timestamp?: number;
    totalItems?: number;
    convertedFrom?: string;
    convertedFor?: string;
    completedItems?: number;
    originalCount?: number;
    failedItems?: number;
  };
}

export interface BaseNodeData {
  id: string;
  type: NodeType;
  position: { x: number; y: number };
  data: any;
  status: ProcessingStatus;
  progress?: number;
  error?: string;
  inputs?: NodePort[];
  outputs?: NodePort[];
}

export interface ProcessingInfo {
  status: ProcessingStatus;
  progress: number;
  startTime: number;
  estimatedTime?: number;
  error?: string;
}

export interface BatchResult {
  id: string;
  filename: string;
  status: ProcessingStatus;
  result?: any;
  thumbnail?: string;
  error?: string;
}

export interface NodeCategory {
  name: string;
  nodes: Array<{
    type: NodeType;
    label: string;
    icon: string;
    description: string;
  }>;
}

// 节点数据接口
export interface TextInputNodeData {
  text: string;
  placeholder: string;
}

export interface ImageUploadNodeData {
  image: File | null;
  preview: string;
}

export interface FolderUploadNodeData {
  files: File[];
  fileCount: number;
  totalSize: number;
}

export interface PromptOptimizeNodeData {
  inputPrompt: string;
  optimizedPrompt: string;
  optimizationSettings: {
    style: 'creative' | 'detailed' | 'concise';
    language: 'zh' | 'en';
  };
}

export interface ImageGenerateNodeData {
  prompt: string;
  generatedImage: string;
  settings: {
    size: '512x512' | '1024x1024';
    style: 'realistic' | 'artistic' | 'anime';
    quality: 'standard' | 'hd';
  };
}

export interface ImageEditNodeData {
  originalImage: string;
  editedImage: string;
  editType: 'style-transfer' | 'background-remove' | 'enhance' | 'resize';
  editSettings: any;
}

export interface VideoGenerateNodeData {
  sourceImage: string;
  generatedVideo: string;
  motionPrompt: string;
  settings: {
    duration: number;
    fps: number;
    quality: 'low' | 'medium' | 'high';
  };
}
