import 'dart:typed_data';

import 'package:hl_lieferservice/dto/discount_add_response.dart';
import 'package:hl_lieferservice/dto/discount_remove_response.dart';
import 'package:hl_lieferservice/dto/discount_update_response.dart';
import 'package:hl_lieferservice/feature/delivery/detail/repository/note_repository.dart';
import 'package:hl_lieferservice/feature/delivery/detail/service/notes_service.dart';
import 'package:hl_lieferservice/feature/delivery/overview/service/delivery_info_service.dart';
import 'package:hl_lieferservice/model/delivery.dart';

class DeliveryRepository {
  DeliveryRepository({required this.service});

  TourService service;

  Future<String?> unscan(String articleId, int newAmount, String reason) async {
    return await service.unscanArticle(articleId, newAmount, reason);
  }

  Future<void> resetScan(String articleId) async {
    return await service.resetScannedArticleAmount(articleId);
  }

  Future<void> uploadDriverSignature(String deliveryId, Uint8List signature) async {
    NoteRepository noteRepository = NoteRepository(service: NoteService());
    await noteRepository.addNamedImage(deliveryId, signature, "delivery_${deliveryId}_signature_driver.jpg");
  }

  Future<void> uploadCustomerSignature(String deliveryId, Uint8List signature) async {
    NoteRepository noteRepository = NoteRepository(service: NoteService());
    await noteRepository.addNamedImage(deliveryId, signature, "delivery_${deliveryId}_signature_customer.jpg");
  }

  Future<DiscountAddResponseDTO> addDiscount(
    String deliveryId,
    String reason,
    int value,
  ) {
    return service.addDiscount(deliveryId, value, reason);
  }

  Future<DiscountRemoveResponseDTO> removeDiscount(String deliveryId) {
    return service.removeDiscount(deliveryId);
  }

  Future<DiscountUpdateResponseDTO> updateDiscount(
    String deliveryId,
    String? reason,
    int? value,
  ) {
    return service.updateDiscount(deliveryId, reason, value);
  }

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