/// Base exception for all API integration errors.
///
/// Concrete channel implementations (WooCommerce, Square, etc.) extend this
/// class to add channel-specific context while preserving a common error
/// contract for callers.
class ApiException implements Exception {
  /// HTTP status code returned by the remote API, or -1 for network-level
  /// errors where no HTTP response was received.
  final int statusCode;

  /// Human-readable description of the error.
  final String message;

  /// Raw response body from the server, if available.
  final String body;

  const ApiException({required this.statusCode, required this.message, this.body = ''});

  @override
  String toString() => 'ApiException($statusCode): $message';
}
