/* cspell:ignore hitl */

export type AgentPanelMode = 'base' | 'capability' | 'tryout';
export type AgentCapabilityKind = 'knowledge' | 'plugin' | 'workflow' | 'mcp';

export interface AgentInteractionConfig {
  inputPlaceholder: string;
  suggestedQuestions: string[];
  welcomeMessage: string;
}

export interface AgentInfo {
  id?: number | string;
  name?: string;
  description?: string;
  avatar?: string;
  categoryId?: number | string;
  modelId?: number | string;
  modelConfigJson?: Record<string, any>;
  generationConfigJson?: Record<string, any>;
  promptConfigJson?: Record<string, any>;
  memoryConfigJson?: Record<string, any>;
  executionConfigJson?: Record<string, any>;
  interactionConfigJson?: AgentInteractionConfig;
  status?: number;
  visibilityScope?: string;
  publishStatus?: string;
  displayPublishStatus?: string;
  approvalPending?: boolean;
  currentApprovalActionType?: string;
  currentApprovalInstanceId?: number | string;
  publishedSnapshotJson?: Record<string, any>;
  toolBindings?: AgentToolBinding[];
  knowledgeBindings?: AgentKnowledgeBinding[];
  created?: string;
  createdByName?: string;
  [key: string]: any;
}

export interface AgentToolBinding {
  id?: number | string;
  agentId?: number | string;
  toolType: 'MCP' | 'PLUGIN' | 'WORKFLOW' | string;
  targetId?: number | string;
  toolName?: string;
  enabled?: boolean;
  hitlEnabled?: boolean;
  hitlConfigJson?: Record<string, any>;
  optionsJson?: Record<string, any>;
  resourceSnapshot?: Record<string, any>;
  resourceSummary?: Record<string, any>;
  sortNo?: number;
  localId?: string;
  [key: string]: any;
}

export interface AgentKnowledgeBinding {
  id?: number | string;
  agentId?: number | string;
  knowledgeId?: number | string;
  retrievalMode?: string;
  enabled?: boolean;
  optionsJson?: Record<string, any>;
  resourceSnapshot?: Record<string, any>;
  resourceSummary?: Record<string, any>;
  sortNo?: number;
  localId?: string;
  [key: string]: any;
}

export interface AgentDraftState {
  agent: AgentInfo;
  toolBindings: AgentToolBinding[];
  knowledgeBindings: AgentKnowledgeBinding[];
  selectedNodeId: string;
  panelMode: AgentPanelMode;
  dirty: boolean;
}

export interface AgentOption {
  label: string;
  value: string;
  raw?: Record<string, any>;
}

export interface AgentValidationIssue {
  nodeId: string;
  message: string;
  field?: string;
}
