import '../utils/http/response_model.dart';
import '../utils/http/dio_request.dart';
import '../models/bo/login_bo.dart';
import '../models/bo/user_info_bo.dart';

class AuthRepository {
  Future<ResponseModel<LoginBO>> login(Map<String, dynamic> params) {
    return DioRequest.instance.post<LoginBO>(
      '/app/auth/login/password',
      data: params,
      fromJsonT: (data) => LoginBO.fromJson(data as Map<String, dynamic>),
    );
  }

  Future<ResponseModel<UserInfoBO>> getUserInfo() {
    return DioRequest.instance.get<UserInfoBO>(
      '/app/auth/user-info',
      fromJsonT: (data) => UserInfoBO.fromJson(data as Map<String, dynamic>),
    );
  }

  Future<ResponseModel> logout() {
    return DioRequest.instance.post('/app/auth/logout');
  }
}
