import 'package:hl_lieferservice/feature/delivery/overview/service/delivery_info_service.dart';
import 'package:hl_lieferservice/model/delivery.dart';
import 'package:hl_lieferservice/model/tour.dart';

class TourRepository {
  DeliveryInfoService service;

  TourRepository({required this.service});

  Future<Tour> loadAll(String userId) async {
    Tour? tour = await service.getTourOfToday(userId);
    return tour!;
  }

  Future<List<Payment>> loadPaymentOptions() async {
    return (await service.getPaymentMethods())
        .map((option) => Payment.fromDTO(option))
        .toList();
  }

  Future<void> assignCar(String deliveryId, String carId) async {
    await service.assignCar(deliveryId, carId);
  }

  Future<void> scanArticle(String internalArticleId) async {
    return await service.scanArticle(internalArticleId);
  }

  Future<void> updateDelivery(Delivery delivery) {
    return service.updateDelivery(delivery);
  }
}
