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'
import PaddleocrPreprocessProvider from './PaddleocrPreprocessProvider'

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)
      case 'paddleocr':
        return new PaddleocrPreprocessProvider(provider, userId)
      default:
        return new DefaultPreprocessProvider(provider)
    }
  }
}
