import 'package:e_commerce_training/src/model/preference/app_preference.dart';
import 'package:e_commerce_training/src/model/repository/app_repository.dart';
import 'package:e_commerce_training/src/page/setting_profile/setting_profile_state.dart';
import 'package:e_commerce_training/src/util/const.dart';
import 'package:e_commerce_training/src/util/util.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

class SettingProfileCubit extends Cubit<SettingProfileState> {
  final AppRepository repository;

  String? get name => appPreference.getData(Const.FULL_NAME);

  String? get avatar => appPreference.getData(Const.AVATAR);

  int get point => appPreference.getIntData(Const.POINT) ?? 10;

  bool get isLoggedIn => !Util.isEmpty(appPreference.getData(Const.TOKEN));

  SettingProfileCubit(this.repository) : super(InitialSettingProfileState());
}
