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

/// Use case for verifying an OTP code.
///
/// This use case delegates the OTP verification logic to the [AuthRepositoryInterface].
class VerifyOtpUseCase implements UseCase<VerifyOtpArguments, User?> {
  final AuthRepositoryInterface _repository;

  /// Creates a [VerifyOtpUseCase].
  ///
  /// Requires an [AuthRepositoryInterface] to interact with the authentication data source.
  VerifyOtpUseCase(this._repository);

  @override
  Future<User?> call(VerifyOtpArguments arguments) {
    return _repository.verifyOtp(
      verificationId: arguments.verificationId,
      smsCode: arguments.smsCode,
      mode: arguments.mode,
    );
  }
}
