import 'dart:convert';
import 'package:http/http.dart' as http;
import '../base_service.dart';
import '../models/forgot_password_model.dart';

class ForgotService {
  Future<ForgotPasswordModel> forgotPassword({
    required String email,
  }) async {
    Uri url = Uri.parse('$baseUrl/auth/mobile/forgot-password');
    var body = jsonEncode({
      'email': email,
    });

    var response = await http.post(url, headers: baseHeader, body: body);
    if (response.statusCode == 200) {
      return ForgotPasswordModel.fromJson(jsonDecode(response.body)['data']);
    } else {
      throw response.body;
    }
  }
}
