class ServerException implements Exception {
  final String message;
  final int? statusCode;

  const ServerException({
    this.message = '服务器错误',
    this.statusCode,
  });

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

class NetworkException implements Exception {
  final String message;

  const NetworkException([this.message = '网络连接失败']);

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

class CacheException implements Exception {
  final String message;

  const CacheException([this.message = '缓存错误']);

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

class AuthException implements Exception {
  final String message;

  const AuthException([this.message = '认证失败']);

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

class WalletException implements Exception {
  final String message;

  const WalletException([this.message = '钱包操作失败']);

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

class BlockchainException implements Exception {
  final String message;

  const BlockchainException([this.message = '区块链交互失败']);

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

class ValidationException implements Exception {
  final String message;

  const ValidationException([this.message = '验证失败']);

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

class StorageException implements Exception {
  final String message;

  const StorageException([this.message = '存储操作失败']);

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

class ApiException implements Exception {
  final String message;
  final int? statusCode;

  const ApiException(this.message, {this.statusCode});

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

class UnauthorizedException implements Exception {
  final String message;

  const UnauthorizedException([this.message = '未授权，请重新登录']);

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

class ForbiddenException implements Exception {
  final String message;

  const ForbiddenException([this.message = '访问被拒绝']);

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

class NotFoundException implements Exception {
  final String message;

  const NotFoundException([this.message = '资源不存在']);

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