import 'dart:convert';

import 'package:http/http.dart';

import '../../../../Model/Request/Staffs/UpdateStaff/Updatestaffrequest.dart';
import '../../../../Model/Response/Staffs/Updatestaff/Updatestaffresponse.dart';

class UpdateStaffProvider{

  Future<UpdateStaffResponse?> updateStaff(UpdateStaffRequest data,String urldata,) async {
    UpdateStaffResponse? updateStaffResponse;
    try {

      final url = Uri.parse(urldata);

      final response = await put(url,
          body: json.encode(data),
          headers: {
            'Content-Type': 'application/json',
            'Accept': 'application/json',
            // 'Authorization': '$token',
          });

      print('updateStaffResponseresponsebody ${response.body}');
      print('updateStaffResponsedatatoJson ${data.toJson()}');
      print('updateStaffResponseresponseorderdate ${data.tenantid}');
      print('updateStaffResponseresponsetenantid ${data.locationid}');
      print('updateStaffResponseresponsepartnerid ${data.partnerid}');



      // print('headerssssssssss ${response.headers}');
      print('updateStaffssssssssss ${urldata.toString()}');
      Map<String, dynamic> parsedJson = json.decode(response.body.toString());

      updateStaffResponse = UpdateStaffResponse.fromJson(parsedJson);
      print('updateStaffinprovider $updateStaffResponse');

    } catch (e) {
      print(e.toString());
      print("error");
    }
    return updateStaffResponse;
  }



}