import { Seam } from '../seam.js'

/**
 * ONE MODULE, USED TWICE. The largest shared seam in the system (#23).
 *
 *   retailer document -> requirement overlay
 *   vendor document   -> answer set
 *
 * Same shape, same confirm step, one implementation. #4 settled that both
 * sides submit documents and both get extracted, so the symmetry is in the
 * domain, not a convenience.
 */
export interface ExtractedSpan {
  documentId: string
  page: number
  span: { start: number; end: number }
}

export interface ExtractedRequirement {
  ordinal: number
  kind: string
  text: string
  provenance: ExtractedSpan
  confidence: number
}

export interface ExtractedAnswer {
  requirementId: string
  coverage: 'answered' | 'not_answered' | 'indeterminate'
  text: string | null
  provenance: ExtractedSpan | null
  confidence: number
}

export function extractRequirements(): ExtractedRequirement[] {
  throw new Seam('#30', 'extraction needs the corpus before it can be built or measured')
}

export function extractAnswers(): ExtractedAnswer[] {
  throw new Seam('#30', 'extraction needs the corpus before it can be built or measured')
}
