import 'package:dartz/dartz.dart';

import '../../../../core/errors/failures.dart';
import '../../data/models/login_request_model.dart';
import '../entities/user_entity.dart';

/// Abstract repository interface for authentication operations
///
/// This defines the contract that the data layer must implement.
/// Returns Either<Failure, Success> for proper error handling.
abstract class AuthRepository {
  /// Login with username and password
  ///
  /// Returns [Right(UserEntity)] on success
  /// Returns [Left(Failure)] on error
  Future<Either<Failure, UserEntity>> login(LoginRequestModel request);

  /// Logout current user
  ///
  /// Returns [Right(void)] on success
  /// Returns [Left(Failure)] on error
  Future<Either<Failure, void>> logout();

  /// Refresh access token
  ///
  /// Returns [Right(UserEntity)] with new tokens on success
  /// Returns [Left(Failure)] on error
  Future<Either<Failure, UserEntity>> refreshToken(String refreshToken);

  /// Check if user is authenticated
  ///
  /// Returns true if valid access token exists
  Future<bool> isAuthenticated();

  /// Get current user from local storage
  ///
  /// Returns [Right(UserEntity)] if user data exists
  /// Returns [Left(Failure)] if no user data found
  Future<Either<Failure, UserEntity>> getCurrentUser();

  /// Clear authentication data (logout locally)
  ///
  /// Returns [Right(void)] on success
  /// Returns [Left(Failure)] on error
  Future<Either<Failure, void>> clearAuthData();
}
