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

class GetSampleRepository extends BaseRepository {
  GetSampleRepository({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_sample/?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,
    // Inputan INFO
    required String jumlahPasien,
    required String edtaRutin,
    required String darahCitras,
    required String serum,
    required String urine,
    required String pleura,
    required String otherTextBahan,
    required String totalOther,
  }) async {
    // final url =
    //     "${Constant.baseUrl}/v1/courier/mobile/process/update_deliver_sample/?id=$id&name=$name&note=$note";

    final url =
        "${Constant.baseUrl}/v1/courier/mobile/process/update_deliver_sample/?id=$id&name=$name&note=$note&t_patient=$jumlahPasien&t_edta=$edtaRutin&t_citras=$darahCitras&t_serum=$serum&t_urine=$urine&t_pleura=$pleura&t_other=$totalOther&other=$otherTextBahan";
    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,
    required String suhuSample,
  }) async {
    final url =
        "${Constant.baseUrl}/v1/courier/mobile/process/update_receive_sample/?id=$id&name=$name&note=$note&suhu=$suhuSample";
    final resp = await get(service: url);
    bool data = false;

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

    return data;
  }
}
