/**
 * OpenAI/AI Feature Types
 */

import type { NotificationState } from './redux';

/**
 * Smart widget data structure for AI-generated visualizations
 */
export interface SmartWidget {
  id: string;
  name: string;
  description?: string;
  query?: string;
  result?: Record<string, unknown>;
}

/**
 * AI response data structure
 */
export interface AIResponseData {
  content: string;
  role: 'assistant' | 'user' | 'system';
  model?: string;
}

/**
 * OpenAI Redux slice state
 */
export interface OpenAIState {
  isFetchingQuery: boolean;
  errorMessage: string;
  smartWidgets: SmartWidget[];
  gptResponse: string | null;
  aiResponse: AIResponseData | null;
  isAskingQuestion: boolean;
  isAskingResponse: boolean;
  notify: NotificationState;
}

/**
 * Request payload for creating a smart widget
 */
export interface CreateWidgetRequest {
  description: string;
  roleId?: string;
  projectId?: string;
  userId?: string;
}

/**
 * Response from widget creation endpoint
 */
export interface CreateWidgetResponse {
  data?: SmartWidget;
  error?: { message: string };
}

/**
 * Single AI message in a conversation
 */
export interface AIMessage {
  role: 'assistant' | 'user' | 'system';
  content: string;
}

/**
 * Request payload for AI response endpoint
 */
export interface AIRequestPayload {
  input: AIMessage[];
  options?: Record<string, unknown>;
}
