///|
/// Selects whether an unformattable accepted value is retained or fatal.
pub(all) enum RewriteFailurePolicy {
  KeepUnformattableCandidate
  FailOnUnformattableCandidate
} derive(Eq, Debug)

///|
/// Configures document scanning and the target notation profile.
pub(all) struct RewriteConfig {
  scan_config : ScanConfig
  target_format : FormatConfig
  failure_policy : RewriteFailurePolicy
} derive(Eq, Debug)

///|
/// Maps one accepted source candidate to its output position.
pub(all) struct RomanReplacement {
  source_span : SourceSpan
  output_span : SourceSpan
  source_text : String
  replacement_text : String
  value : Int
} derive(Eq, Debug)

///|
/// Records an accepted source value retained after target formatting failed.
pub(all) struct RomanRewriteSkipped {
  source_span : SourceSpan
  source_text : String
  value : Int
  error : FormatError
} derive(Eq, Debug)

///|
/// Returns rewritten text, mapping evidence, and the original scan report.
pub(all) struct RomanRewriteReport {
  original : String
  output : String
  replacements : Array[RomanReplacement]
  skipped : Array[RomanRewriteSkipped]
  scan_report : RomanScanReport
} derive(Eq, Debug)

///|
/// Reports scanner configuration or target-format failures.
pub(all) enum RomanRewriteError {
  RewriteScanConfigurationFailed(ConfigError)
  RewriteFormatFailed(SourceSpan, FormatError)
} derive(Eq, Debug)