/// Repository Implementation: Points Record
///
/// Implements points record repository interface.
library;

import 'package:worker/features/loyalty/data/datasources/points_record_remote_datasource.dart';
import 'package:worker/features/loyalty/domain/entities/points_record.dart';
import 'package:worker/features/loyalty/domain/repositories/points_record_repository.dart';

/// Points Record Repository Implementation
class PointsRecordRepositoryImpl implements PointsRecordRepository {
  const PointsRecordRepositoryImpl(this._remoteDataSource);

  final PointsRecordRemoteDataSource _remoteDataSource;

  @override
  Future<List<PointsRecord>> getPointsRecords() async {
    try {
      return await _remoteDataSource.getPointsRecords();
    } catch (e) {
      rethrow;
    }
  }

  @override
  Future<PointsRecord> getPointsRecordById(String recordId) async {
    try {
      return await _remoteDataSource.getPointsRecordById(recordId);
    } catch (e) {
      rethrow;
    }
  }

  @override
  Future<PointsRecord> submitPointsRecord(PointsRecord record) async {
    try {
      return await _remoteDataSource.submitPointsRecord(record);
    } catch (e) {
      rethrow;
    }
  }
}
