
import 'package:dio/dio.dart';

import '../../../constants/api_constants.dart';
import '../../../data/authentication/auth_request.dart';
import '../../../data/authentication/auth_response.dart';
import '../../../modules/authentication/auth.dart';
import '../../../modules/authentication/getbyid.dart';
import '../../provider/authentication/auth_provider.dart';


class LoginRepository{

  LoginProvider loginProvider = LoginProvider();
  final LoginProvider _profileProvider = LoginProvider();

  Future<LoginResponse?> signIn(LoginRequest data) async {

    return await loginProvider.signIn('${ApiConstants.login}',data);

  }
  Future<CustomerFullView?> fetchProfile(String customerId) async {
    return await _profileProvider.getProfile(customerId);
  }


  Future<dynamic> updateProfile(dynamic data) async {
    final String url = ApiConstants.updateCustomer;
    try {
      final dio = Dio();
      // print(url);
      final response = await dio.put(url, data: data);

      return response.data;

    } catch (e) {
      print("Error updating profile: $e");
      return null;
    }
  }

}