// ============================================================
// ReferralProvider — 推荐/邀请系统 Riverpod Providers
// ============================================================

import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../../../../core/services/referral_service.dart';

final referralServiceProvider = Provider<ReferralService>((ref) {
  return ReferralService.instance;
});

/// 当前用户推荐信息（自动缓存 5 分钟）
final myReferralInfoProvider = FutureProvider.autoDispose((ref) async {
  return ref.read(referralServiceProvider).getMyInfo();
});

/// 直接推荐列表
final directReferralsProvider =
    FutureProvider.autoDispose.family<List<Map<String, dynamic>>, int>(
        (ref, offset) async {
  return ref.read(referralServiceProvider).getDirectReferrals(offset: offset);
});
