import '../app/constant.dart';
import 'base_repository.dart';

class ResultDeliveryRepository extends BaseRepository {
  ResultDeliveryRepository({required super.dio});

  Future<bool> setLocation(
      {required String id,
      required String step,
      required String lat,
      required String long,
      required String address,
      required String branchID}) async {
    final url =
        "${Constant.baseUrl}/v1/courier/mobile/process/add_delivery/?id=$id&locid=$step&lat=$lat&long=$long&address=$address&branchid=$branchID";
    final resp = await get(service: url);
    bool data = false;

    if (resp['status'] == "OK") {
      data = true;
    }

    return data;
  }

  Future<bool> setDeliveryPerson({
    required String id,
    required String name,
    required String note,
  }) async {
    final url =
        "${Constant.baseUrl}/v1/courier/mobile/process/update_deliver/?id=$id&name=$name&note=$note";
    final resp = await get(service: url);
    bool data = false;

    if (resp['status'] == "OK") {
      data = true;
    }

    return data;
  }

  Future<bool> setReceivePerson({
    required String id,
    required String name,
    required String note,
  }) async {
    final url =
        "${Constant.baseUrl}/v1/courier/mobile/process/update_receive/?id=$id&name=$name&note=$note";
    final resp = await get(service: url);
    bool data = false;

    if (resp['status'] == "OK") {
      data = true;
    }

    return data;
  }
}
