import 'dart:convert';

import 'package:http/http.dart';

import '../../../../Model/Request/Authentication/Createuser/Createuserresponse.dart';
import '../../../../Model/Response/Authentication/Createtenantuser/Createtenantuserresponse.dart';



class CreateTenantUserProviders{

  Future<CreateTenantUserResponse?> createTenantUser(CreateTenantUser data,String urldata,) async {
    CreateTenantUserResponse? createTenantUserResponse;
    try {

      final url = Uri.parse('$urldata');

      final response = await post(url,
          body: json.encode(data),
          headers: {
            'Content-Type': 'application/json',
            'Accept': 'application/json',
            // 'Authorization': '$token',
          });
      print('CreateTenantUserresponsebody ${response.body}');
      print('CreateTenantUserdata ${data.toJson()}');
      print('CreateTenantUserdatatenantlocations ${data.tenantlocations!.toJson()}');
      print('CreateTenantUserdatatenantsubscriptions ${data.tenantsubscriptions!.toJson()}');
      print('CreateTenantUserurlsssssssssss ${urldata.toString()}');

      Map<String, dynamic> parsedJson = json.decode(response.body.toString());




      createTenantUserResponse = CreateTenantUserResponse.fromJson(parsedJson);
      print('createOrderinprovider${createTenantUserResponse}');

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

}