This commit is contained in:
Phuoc Nguyen
2025-10-17 17:49:01 +07:00
parent 628c81ce13
commit 57bf73e4d1
23 changed files with 2655 additions and 87 deletions

View File

@@ -0,0 +1,49 @@
/// Domain Repository Interface: Home Repository
///
/// Defines the contract for home-related data operations.
/// This is an abstract interface following the Repository Pattern.
///
/// The actual implementation will be in the data layer.
/// This allows for dependency inversion and easier testing.
library;
import 'package:worker/features/home/domain/entities/member_card.dart';
import 'package:worker/features/home/domain/entities/promotion.dart';
/// Home Repository Interface
///
/// Provides methods to:
/// - Get member card information
/// - Fetch active promotions
///
/// Implementation will be in data/repositories/home_repository_impl.dart
abstract class HomeRepository {
/// Get the current user's member card
///
/// Returns [MemberCard] with user's membership information.
/// Throws exception if user not authenticated or data unavailable.
///
/// This should fetch from local cache first (Hive), then sync with server.
Future<MemberCard> getMemberCard();
/// Get list of active promotions
///
/// Returns list of [Promotion] objects that are currently active.
/// Returns empty list if no promotions available.
///
/// This should fetch from local cache first, then sync with server.
/// Promotions should be ordered by priority/start date.
Future<List<Promotion>> getPromotions();
/// Refresh member card data from server
///
/// Force refresh member card information from remote source.
/// Updates local cache after successful fetch.
Future<MemberCard> refreshMemberCard();
/// Refresh promotions from server
///
/// Force refresh promotions from remote source.
/// Updates local cache after successful fetch.
Future<List<Promotion>> refreshPromotions();
}