2025-11-16 11:25:27 +00:00
|
|
|
import 'package:injectable/injectable.dart';
|
2025-12-13 13:27:05 +00:00
|
|
|
import 'package:mnemo_cards_backend/database/database.dart';
|
2025-11-16 11:25:27 +00:00
|
|
|
import 'package:mnemo_cards_common_backend/mnemo_cards_common_backend.dart';
|
|
|
|
|
import 'package:mnemo_cards_common/mnemo_cards_common.dart';
|
|
|
|
|
|
|
|
|
|
@lazySingleton
|
|
|
|
|
class SubscriptionManager {
|
2025-12-13 13:27:05 +00:00
|
|
|
final AppDatabase _db;
|
2025-11-16 11:25:27 +00:00
|
|
|
|
2025-12-13 13:27:05 +00:00
|
|
|
SubscriptionManager(this._db);
|
2025-11-16 11:25:27 +00:00
|
|
|
|
2025-12-13 13:27:05 +00:00
|
|
|
Future<SubscriptionDto> getSubscriptionDto(UserModel user) async {
|
|
|
|
|
// TODO: Implement with Drift
|
2025-11-16 11:25:27 +00:00
|
|
|
return SubscriptionDto(
|
2025-12-13 13:27:05 +00:00
|
|
|
page: null,
|
2025-11-16 11:25:27 +00:00
|
|
|
isActive: false,
|
|
|
|
|
start: null,
|
|
|
|
|
finish: null,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-13 13:27:05 +00:00
|
|
|
Future<SubscriptionPlanModel?> getSubscriptionPlan(String id) async {
|
|
|
|
|
final intId = int.tryParse(id);
|
|
|
|
|
if (intId == null) return null;
|
2025-11-16 11:25:27 +00:00
|
|
|
|
2025-12-13 13:27:05 +00:00
|
|
|
final plan = await _db.subscriptionDao.getPlanById(intId);
|
|
|
|
|
if (plan == null) return null;
|
2025-11-16 11:25:27 +00:00
|
|
|
|
2025-12-13 13:27:05 +00:00
|
|
|
// TODO: Convert SubscriptionPlan (Drift) to SubscriptionPlanModel (Isar)
|
|
|
|
|
return null; // Temporary return null
|
|
|
|
|
}
|
2025-11-16 11:25:27 +00:00
|
|
|
|
2025-12-13 13:27:05 +00:00
|
|
|
Future<void> createSubscription(UserModel user, SubscriptionPlanModel plan) async {
|
|
|
|
|
// TODO: Implement with Drift
|
|
|
|
|
throw UnimplementedError('SubscriptionManager.createSubscription not implemented');
|
|
|
|
|
}
|
2025-11-16 11:25:27 +00:00
|
|
|
|
2025-12-13 13:27:05 +00:00
|
|
|
Future<List<SubscriptionPlanModel>> getAllPlans() async {
|
|
|
|
|
// TODO: Implement with Drift
|
|
|
|
|
return [];
|
2025-11-16 11:25:27 +00:00
|
|
|
}
|
2025-12-13 13:27:05 +00:00
|
|
|
}
|