import '../../../core/usecases/usecase.dart';
import '../../../core/error/failures.dart';
import '../models/otp_response.dart';

class SendOTP extends UseCase<OTPResponse, SendOTPParams> {
  @override
  Future<Result<OTPResponse>> call(SendOTPParams params) async {
    try {
      await Future.delayed(const Duration(seconds: 2));
      
      final response = OTPResponse(
        timeStamp: DateTime.now().millisecondsSinceEpoch.toString(),
        timeDue: DateTime.now().add(const Duration(minutes: 2)).millisecondsSinceEpoch.toString(),
      );
      
      return Result.success(response);
    } catch (e) {
      return Result.failure(ServerFailure());
    }
  }
}

class SendOTPParams {
  final String phoneNumber;

  SendOTPParams({required this.phoneNumber});
}