import type { PreprocessProvider } from '@types'

import type BasePreprocessProvider from './BasePreprocessProvider'
import DefaultPreprocessProvider from './DefaultPreprocessProvider'
import Doc2xPreprocessProvider from './Doc2xPreprocessProvider'
import MineruPreprocessProvider from './MineruPreprocessProvider'
import MistralPreprocessProvider from './MistralPreprocessProvider'
import OpenMineruPreprocessProvider from './OpenMineruPreprocessProvider'
export default class PreprocessProviderFactory {
  static create(provider: PreprocessProvider, userId?: string): BasePreprocessProvider {
    switch (provider.id) {
      case 'doc2x':
        return new Doc2xPreprocessProvider(provider)
      case 'mistral':
        return new MistralPreprocessProvider(provider)
      case 'mineru':
        return new MineruPreprocessProvider(provider, userId)
      case 'open-mineru':
        return new OpenMineruPreprocessProvider(provider, userId)
      default:
        return new DefaultPreprocessProvider(provider)
    }
  }
}
