import 'package:rasadyar_chicken/data/data_source/remote/auth/auth_remote.dart';
import 'package:rasadyar_chicken/data/models/response/user_info/user_info_model.dart';
import 'package:rasadyar_chicken/data/models/response/user_profile_model/user_profile_model.dart';

import 'auth_repository.dart';

class AuthRepositoryImpl implements AuthRepository {
  final AuthRemoteDataSource authRemote;

  AuthRepositoryImpl(this.authRemote);

  @override
  Future<UserProfileModel?> login({required Map<String, dynamic> authRequest}) async =>
      await authRemote.login(authRequest: authRequest);

  @override
  Future<void> logout() async => await authRemote.logout();

  @override
  Future<bool> hasAuthenticated() async => await authRemote.hasAuthenticated();

  @override
  Future<UserInfoModel?> getUserInfo(String phoneNumber) async =>
      await authRemote.getUserInfo(phoneNumber);

  @override
  Future<void> submitUserInfo({required String phone, String? deviceName}) async {
    var tmp = {'mobile': phone, 'device_name': deviceName};
    await authRemote.submitUserInfo(tmp);
  }
}
