import type { StorageBackendKey } from '@/components/storage/storageSettingsConfig'
import type { UIComponent } from '@/types/json-ui'

export type SaveIndicatorStatus = 'saved' | 'synced'

export interface SaveIndicatorWrapperProps {
  status?: SaveIndicatorStatus
  label?: string
  showLabel?: boolean
  animate?: boolean
  className?: string
}

export interface LazyBarChartWrapperProps {
  data: Array<Record<string, any>>
  xKey: string
  yKey: string
  width?: number | string
  height?: number
  color?: string
  showGrid?: boolean
  showTooltip?: boolean
  showLegend?: boolean
  className?: string
}

export interface LazyLineChartWrapperProps {
  data: Array<Record<string, any>>
  xKey: string
  yKey: string
  width?: number | string
  height?: number
  color?: string
  showGrid?: boolean
  showTooltip?: boolean
  showLegend?: boolean
  className?: string
}

export interface LazyD3BarChartWrapperProps {
  data: Array<{ label: string; value: number }>
  width?: number
  height?: number
  color?: string
  className?: string
}

export interface SeedDataManagerWrapperProps {
  isLoaded?: boolean
  isLoading?: boolean
  title?: string
  description?: string
  loadLabel?: string
  loadingLabel?: string
  resetLabel?: string
  resettingLabel?: string
  clearLabel?: string
  clearingLabel?: string
  onLoadSeedData?: () => void
  onResetSeedData?: () => void
  onClearAllData?: () => void
  helperText?: {
    load?: string
    reset?: string
    clear?: string
  }
}

export interface StorageSettingsWrapperProps {
  backend?: StorageBackendKey | null
  isLoading?: boolean
  flaskUrl?: string
  isSwitching?: boolean
  onFlaskUrlChange?: (value: string) => void
  onSwitchToFlask?: () => void
  onSwitchToIndexedDB?: () => void
  onSwitchToSQLite?: () => void
  isExporting?: boolean
  isImporting?: boolean
  onExport?: () => void
  onImport?: () => void
}

export interface GitHubBuildStatusWorkflowItem {
  id: string
  name: string
  status?: string
  conclusion?: string | null
  branch?: string
  updatedAt?: string
  event?: string
  url?: string
}

export interface GitHubBuildStatusWrapperProps {
  title?: string
  description?: string
  workflows?: GitHubBuildStatusWorkflowItem[]
  isLoading?: boolean
  errorMessage?: string
  emptyMessage?: string
  footerLinkLabel?: string
  footerLinkUrl?: string
  className?: string
}

export interface ComponentBindingField {
  id: string
  label: string
  value?: string
  placeholder?: string
}

export interface ComponentBindingDialogWrapperProps {
  open?: boolean
  title?: string
  description?: string
  componentType?: string
  componentId?: string
  bindings?: ComponentBindingField[]
  onBindingChange?: (id: string, value: string) => void
  onSave?: () => void
  onCancel?: () => void
  onOpenChange?: (open: boolean) => void
  className?: string
}

export interface DataSourceField {
  id: string
  label: string
  value?: string
  placeholder?: string
  helperText?: string
}

export interface DataSourceEditorDialogWrapperProps {
  open?: boolean
  title?: string
  description?: string
  fields?: DataSourceField[]
  onFieldChange?: (id: string, value: string) => void
  onSave?: () => void
  onCancel?: () => void
  onOpenChange?: (open: boolean) => void
  className?: string
}

export interface ComponentTreeWrapperProps {
  components?: UIComponent[]
  selectedId?: string | null
  emptyMessage?: string
  onSelect?: (id: string) => void
  className?: string
}
