import 'package:guru_utils/datetime/datetime_utils.dart';
import 'package:guru_utils/property/app_property.dart';

const _group = 'guru_rating';
const _appRated = PropertyKey.general('app_rated', group: _group);
const _latestPopRateGuide = PropertyKey.general('latest_pop_rate_guide_time', group: _group);

extension RatingGuideProperty on AppProperty {
  Future<bool> isRated() async {
    return await getBool(_appRated, defValue: false);
  }

  Future setRated() async {
    return await setBool(_appRated, true);
  }

  Future<int> getLatestPopRateGuideTime() async {
    return await getInt(_latestPopRateGuide, defValue: 0);
  }

  Future refreshLatestPopRateGuideTime() async {
    return await setInt(_latestPopRateGuide, DateTimeUtils.currentTimeInMillis());
  }
}
