// Database 相关类型定义

export interface Database {
  id: string
  name: string
  description: string
  db_type: string
  host: string
  port: number
  username: string
  password: string
  database: string
  table_count: number
  created_at: string
  updated_at: string
}

export interface TableInfo {
  name: string
  ddl: string
  columns: ColumnInfo[]
  table_comment?: string
}

export interface ColumnInfo {
  name: string
  type: string
  comment: string
  mapped_name: string
  column_type?: string
  is_nullable?: string
  default_value?: string
  column_key?: string
}

export interface DbForm {
  name: string
  db_type: string
  description: string
  host: string
  port: number
  username: string
  password: string
  database: string
}

// Neo4j 图谱相关类型
export interface Neo4jLabel {
  name: string
  count: number
}

export interface Neo4jRelType {
  name: string
  count: number
}

export interface Neo4jGraphData {
  labels: Neo4jLabel[]
  relationshipTypes: Neo4jRelType[]
}

export interface Neo4jCheckResponse {
  success: boolean
  message: string
  version?: string
  databases?: string[]
  databaseId?: string
  name?: string
  description?: string
  graphs?: Neo4jGraphData
}

export interface Neo4jNodeProperty {
  label: string
  properties: {
    name: string
    type: string
  }[]
}

export interface Neo4jRelProperty {
  type: string
  properties: {
    name: string
    type: string
  }[]
}

export interface Neo4jNodeRequest {
  uri?: string
  host?: string
  port?: number
  username: string
  password: string
  database: string
  label: string
  limit?: number
}

export interface Neo4jNodesResponse {
  success: boolean
  message: string
  nodes: any[]
  properties: {
    name: string
    type: string
  }[]
}

export interface Neo4jRelRequest {
  uri?: string
  host?: string
  port?: number
  username: string
  password: string
  database: string
  relationshipType: string
  limit?: number
}

export interface Neo4jRelationshipsResponse {
  success: boolean
  message: string
  relationships: {
    id: string
    source: string
    target: string
    properties: any
  }[]
}
