export type ProcessType = 'structured' | 'unstructured' | 'external'

export type StepId = 'create' | 'model' | 'upload' | 'preview' | 'generate' | 'results'

export type PreprocessOption =
  | 'clean_invalid'
  | 'detect_structure'
  | 'deduplicate'
  | 'normalize_format'
  | 'filter_anomaly'
  | 'desensitize'

export interface DatasetSplitOptions {
  train: number
  validation: number
  test: number
}

export interface GenerationControlOptions {
  generationModelId: string | number | ''
  generationPrompt: string
  temperature: number
  maxTokens: number
  jsonMode: boolean
  qualityFilterEnabled: boolean
  filterLowQuality: boolean
  filterShortContent: boolean
  minOutputLength: number
}

export interface StructuredProcessOptions extends GenerationControlOptions {
  preprocessOptions: PreprocessOption[]
  semanticEnrichment: boolean
  qaPairsPerRow: number
  datasetSplit: DatasetSplitOptions
}

export type UnstructuredPreprocessOption =
  | 'clean_invalid_content'
  | 'detect_document_structure'
  | 'merge_short_content'
  | 'filter_low_quality'
  | 'deduplicate_content'
  | 'desensitize'
  | 'preserve_context'

export type ChunkMethod = 'semantic' | 'heading' | 'fixed' | 'custom'

export interface UnstructuredProcessOptions extends GenerationControlOptions {
  preprocessOptions: UnstructuredPreprocessOption[]
  chunkMethod: ChunkMethod
  chunkSize: number
  chunkOverlap: number
  minChunkSize: number
  customDelimiter: string
  preserveTables: boolean
  preserveCodeBlocks: boolean
  preserveLists: boolean
  semanticEnrichment: boolean
  qaPairsPerChunk: number
  datasetSplit: DatasetSplitOptions
}

export interface ExternalDataSource {
  type: string
  url: string
  authMode: string
  username?: string
  password?: string
  token?: string
  limit: number
}

export interface UploadedDataFile {
  uid: string | number
  name: string
  size: number
  count: number
  content: string
}

export interface SourceLine {
  number: number
  content: string
  start: number
  end: number
}

export interface PreviewItem {
  id: string
  sourceFileId: string
  originalContent: string
  editedContent: string
  sourceStart: number | null
  sourceEnd: number | null
  sourceStartLine: number | null
  sourceEndLine: number | null
  tokenCount: number
  status: 'original' | 'modified' | 'manual' | 'invalid'
}

export interface GenerationState {
  status: 'idle' | 'running' | 'success' | 'failed'
  progress: number
  message: string
}

export interface ResultItem {
  id: string
  instruction: string
  input: string
  output: string
  originalInstruction: string
  originalInput: string
  originalOutput: string
  status: 'valid' | 'modified' | 'invalid'
  error?: string
}
