export interface TagSuggestion {
  tag: string;
  confidence: number;
  reasoning?: string;
  isNewLabel?: boolean;
}

export interface TitleSuggestion {
  title: string;
  confidence: number;
  reasoning?: string;
}

export interface ToolUseOptions {
  tools: Record<string, any>  // AI SDK tool() objects
  maxSteps?: number
  systemPrompt?: string
  messages?: any[]
  prompt?: string
}

export interface ToolCallResult {
  toolCalls: Array<{ toolName: string; input: any }>
  toolResults: Array<{ toolName: string; input: any; output: any }>
  text: string
  steps: Array<{
    text: string
    toolCalls: Array<{ toolName: string; input: any }>
    toolResults: Array<{ toolName: string; input: any; output: any }>
  }>
}

export interface AIProvider {
  /**
   * Analyze content and suggest relevant tags.
   */
  generateTags(content: string, language?: string): Promise<TagSuggestion[]>;

  /**
   * Generate an embedding vector for semantic search.
   */
  getEmbeddings(text: string): Promise<number[]>;

  /**
   * Generate title suggestions based on content.
   */
  generateTitles(prompt: string): Promise<TitleSuggestion[]>;

  /**
   * Generate text based on a prompt.
   */
  generateText(prompt: string): Promise<string>;

  /**
   * Provide a chat response (used for the agentic system)
   */
  chat(messages: any[], systemPrompt?: string): Promise<any>;

  /**
   * Return the AI SDK model for direct streaming (used by API route)
   */
  getModel(): any;

  /**
   * Generate text with tool-use support (multi-step agent loop)
   */
  generateWithTools(options: ToolUseOptions): Promise<ToolCallResult>;
}

export type AIProviderType = 'openai' | 'ollama' | 'custom' | 'deepseek' | 'openrouter';
