import 'package:equatable/equatable.dart';

abstract class Failure extends Equatable implements Exception {
  final String message;

  const Failure(this.message);
}

class ServerFailure extends Failure {
  final String url;

  const ServerFailure(super.message, {this.url = ""});

  @override
  List<Object?> get props => [message];
}

class UserIntimationFailure extends Failure {
  const UserIntimationFailure(super.message);

  @override
  List<Object?> get props => [message];
}

class MessageStatusFailure extends Failure {
  const MessageStatusFailure(super.message);

  @override
  List<Object?> get props => [message];
}

class AppUpdateFailure extends Failure {
  const AppUpdateFailure(super.message);

  @override
  List<Object?> get props => [message];
}

class StatusCodeFailure extends Failure {
  const StatusCodeFailure(super.message);

  @override
  List<Object?> get props => [message];
}

class UnAuthenticatedUserFailure extends Failure {
  final String url;

  const UnAuthenticatedUserFailure(super.message, {this.url = ""});

  @override
  List<Object?> get props => [message];
}

class ConnectivityFailure extends Failure {
  const ConnectivityFailure(super.message);

  @override
  List<Object?> get props => [message];
}

class LocalStorageFailure extends Failure {
  const LocalStorageFailure(super.message);

  @override
  List<Object?> get props => [message];
}

class DataParsingFailure extends Failure {
  const DataParsingFailure(super.message);

  @override
  List<Object?> get props => [message];
}

class UnknownFailure extends Failure {
  final String url;

  const UnknownFailure(super.message, {this.url = ""});

  @override
  List<Object?> get props => [message];
}

class DuplicateUsername extends Failure {
  const DuplicateUsername(String? message) : super(message ?? '');

  @override
  List<Object?> get props => [message];
}

class InvalidCredentials extends Failure {
  const InvalidCredentials(String? message) : super(message ?? '');

  @override
  List<Object?> get props => [message];
}
