enum ObstacleDirection { left, center, right }

class DetectionResult {
  final String label;
  final double confidence;
  final ObstacleDirection direction;
  final String estimatedDistance;

  const DetectionResult({
    required this.label,
    required this.confidence,
    required this.direction,
    required this.estimatedDistance,
  });

  String get directionName => direction.name.toUpperCase();

  String get spokenId {
    final area = switch (direction) {
      ObstacleDirection.left => 'kiri',
      ObstacleDirection.center => 'tengah',
      ObstacleDirection.right => 'kanan',
    };
    return 'Hati-hati, $label di $area. Jarak $estimatedDistance.';
  }
}

class ObstacleAnalyzer {
  DetectionResult analyzeFallback({String label = 'person', double confidence = 0.86}) {
    return DetectionResult(
      label: label,
      confidence: confidence,
      direction: ObstacleDirection.center,
      estimatedDistance: 'Close',
    );
  }
}
