import 'package:cpt_profile/modules/change_mobile/change_mobile_page.dart';
import 'package:cpt_profile/modules/reset_password/reset_password_page.dart';
import 'package:cpt_profile/modules/setting/dialog/account_deactivation_dialog.dart';
import 'package:cpt_profile/modules/setting/setting_state.dart';
import 'package:cs_resources/generated/l10n.dart';
import 'package:plugin_platform/engine/dialog/dialog_engine.dart';
import 'package:plugin_platform/engine/toast/toast_engine.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
import 'package:widgets/dialog/app_default_dialog.dart';

part 'setting_view_model.g.dart';

@riverpod
class SettingViewModel extends _$SettingViewModel {
  @override
  SettingState build() {
    return SettingState();
  }

  void changeEnableNotification(bool value) {
    state = state.copyWith(enbaleNofitication: value);
  }

  //去修改手机号码的页面
  void gotoChangeMobilePage() {
    ChangeMobilePage.startInstance();
  }

  void gotoResetPasswordPage() {
    ResetPasswordPage.startInstance();
  }

  // 退出登录
  void doLogout() {
    DialogEngine.show(
        widget: AppDefaultDialog(
      message: "Are you sure you want to logout?",
      confirmAction: () {
        ToastEngine.show("点击了确定");
      },
    ));
  }

  //展示删除账号的提示弹窗
  void doDeleteAccount() {
    DialogEngine.show(widget: AccountDeactivationDialog(
      confirmAction: () {
        ToastEngine.show("点击了确定");
      },
    ));
  }

}
