
import 'package:shared_preferences/shared_preferences.dart';
import 'package:traderscircuit/Utils/api_urls.dart';
import 'package:traderscircuit/Utils/base_manager.dart';
import 'package:traderscircuit/data/network/network_api_services.dart';

class PostProfileAPI {
  PostProfileAPI(this.data);
  var data;
  Future<ResponseData<dynamic>> ProfileApi() async {
    SharedPreferences prefs = await SharedPreferences.getInstance();
    final response = await NetworkApiServices().postApi(
        data,
        // "https://development.wedzy.co/vendor_api/v1/vendor_business_add_information",
        ApiUrls.updateprofile
        // optionalpar: true,
        );

    if (response.status == ResponseStatus.SUCCESS) {
      Map<String, dynamic> responseData =
          Map<String, dynamic>.from(response.data);
      if (responseData['status'] == "success") {
        // print("registration sucess");
        print("profile updated");
      } else {
        return ResponseData<dynamic>(
            responseData['message'], ResponseStatus.FAILED);
      }
    } else if (response.status == ResponseStatus.FAILED &&
        response.message == "Forbidden") {
      Map<String, dynamic> responseData =
          Map<String, dynamic>.from(response.data);
      return ResponseData<dynamic>(
          responseData['message'][0], ResponseStatus.FAILED);
    }
    return response;
  }
}