export type AIActionType =
  | 'generate_full'
  | 'generate_branch'
  | 'modify_node'
  | 'add_steps'
  | 'quick_action'
  | 'open_chat'
  | 'variable_inference'

export interface AIDelta {
  action: 'add' | 'modify' | 'delete'
  target_node_id: string
  nodes: Record<string, unknown>[]
  explanation: string
}

export interface AISuggestion {
  id: string
  action_type: AIActionType
  target_node_id: string | null
  changes_json: {
    before?: Record<string, unknown>
    after?: Record<string, unknown>
    delta?: AIDelta
  }
  status: 'pending' | 'accepted' | 'dismissed'
  created_at: string
  resolved_at: string | null
}

export interface EditorAIChatMessage {
  role: 'user' | 'assistant'
  content: string
  timestamp: string
  action_type?: AIActionType
  delta?: AIDelta
  knowledge?: KnowledgeCitation[]
}

export interface KnowledgeCitation {
  title: string
  url: string
  excerpt: string
}

export interface ContextMenuAction {
  id: string
  label: string
  icon: string
  action_type: AIActionType
  description?: string
}

export interface ContextMenuPosition {
  x: number
  y: number
}

export interface SuggestionMarker {
  _suggestion?: true
  _suggestion_id?: string
}
