import 'dart:typed_data';

/// Extracts a suggested variety name from a photo of its packet/label — an
/// optional, best-effort enrichment for the draft-triage flow. Kept behind this
/// interface so the app degrades gracefully: platforms without an on-device OCR
/// engine (desktop, web) get [NoOpLabelTextExtractor], and the UI hides the
/// "suggest name" affordance when [isSupported] is false.
abstract class LabelTextExtractor {
  /// Whether this build can actually run OCR (true only where a native engine
  /// is wired). The UI uses it to decide whether to offer the suggestion.
  bool get isSupported;

  /// Returns a suggested name read from [photo], or null when nothing usable
  /// was found or OCR is unavailable. Never throws — failures yield null.
  Future<String?> suggestLabel(Uint8List photo);
}

/// The fallback where no on-device OCR exists: always unsupported, always null.
class NoOpLabelTextExtractor implements LabelTextExtractor {
  const NoOpLabelTextExtractor();

  @override
  bool get isSupported => false;

  @override
  Future<String?> suggestLabel(Uint8List photo) async => null;
}
