import 'dart:convert';

import '../models/personal_information_model.dart';

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

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

  Future<List<PersonalInformationModel>> getPersonalInformation(
      {required String mCourierID}) async {
    final param = {
      "id": mCourierID
    };

    final url =
        "${Constant.baseUrl}/v1/courier/mobile/profile/info/?id=$mCourierID";
    final resp = await get(service: url);
    // print("url :" + url);
    List<PersonalInformationModel> data;
    // print(resp['data']);
    if (resp['status'] == 'OK' && resp['status'] != null) {
      data = [];
      resp['data'].forEach((e) {
        final model = PersonalInformationModel.fromJson(e);
        data.add(model);
      });
    } else {
      data = [];
    }
    return data;
  }
}
