import 'package:krow_core/core.dart';
import 'package:krow_domain/krow_domain.dart';
import '../arguments/sign_in_with_email_arguments.dart';
import '../repositories/auth_repository_interface.dart';

/// Use case for signing in a client using email and password.
///
/// This use case encapsulates the logic for authenticating an existing user
/// via email/password credentials.
class SignInWithEmailUseCase
    implements UseCase<SignInWithEmailArguments, User> {
  final AuthRepositoryInterface _repository;

  const SignInWithEmailUseCase(this._repository);

  /// Executes the sign-in operation.
  @override
  Future<User> call(SignInWithEmailArguments params) {
    return _repository.signInWithEmail(
      email: params.email,
      password: params.password,
    );
  }
}
