import '../../network_api_service/api_service/api_service.dart';
import '../../network_api_service/api_urls/api_urls.dart';
import '../models/login_model.dart';

class LoginRepository {
  final ApiService _apiService = ApiService();

  Future<LoginModel> login({
    required String emailAddress,
    required String password,
    bool rememberMe = false,
  }) async {
    try {
      final response = await _apiService.post(
        ApiUrls.login,
        data: {
          "emailAddress": emailAddress,
          "password": password,
          "rememberMe": rememberMe,
        },
      );

      return LoginModel.fromJson(response.data as Map<String, dynamic>);
    } catch (e) {
      rethrow;
    }
  }
}