import 'package:freezed_annotation/freezed_annotation.dart';

part 'errors.freezed.dart';

@freezed
class AppError with _$AppError {
  const factory AppError.unknown({String? message}) = UnknownError;
  const factory AppError.network({String? message}) = NetworkError;
  const factory AppError.unauthorized({String? message}) = UnauthorizedError;
  const factory AppError.forbidden({String? message}) = ForbiddenError;
  const factory AppError.notFound({String? message}) = NotFoundError;
  const factory AppError.server({int? statusCode, String? message}) = ServerError;
  const factory AppError.database({String? message}) = DatabaseError;
  const factory AppError.validation({String? message, Map<String, String>? fieldErrors}) = ValidationError;
  const factory AppError.parsing({String? message}) = ParsingError;
}
