/**
 * Default extraction provider — fully self-hosted, no network, no key.
 * Generic German/EU heuristics + the per-vendor learned profile. This is the
 * locked default; the LLM provider is an opt-in plug-in (see index.ts).
 */

import { extractFields } from '../fieldExtractors'
import { applyProfile } from '../vendorProfile'
import type { ExtractionProvider, ExtractionInput } from './types'

export const selfHostedProvider: ExtractionProvider = {
  name: 'self-hosted',
  async extract(input: ExtractionInput) {
    const base = extractFields(input.text || '', input.items)
    return input.vendorProfile ? applyProfile(base, input.vendorProfile) : base
  }
}

export default selfHostedProvider
