import { Component, OnInit } from '@angular/core';
import { Router, RouterModule } from '@angular/router';
import { IonicModule, NavController } from '@ionic/angular';
import { IonContent, IonHeader, IonIcon } from '@ionic/angular/standalone';
import { addIcons } from 'ionicons';
import { arrowBackOutline, bagRemoveOutline, chevronForwardOutline, closeCircleOutline, createOutline, handRightOutline, informationCircleOutline, lockOpenOutline, logOutOutline, shieldCheckmarkOutline, skullOutline } from 'ionicons/icons';
import { CloudUser } from 'src/lib/ncloud';
addIcons({
  createOutline, arrowBackOutline, chevronForwardOutline, handRightOutline, lockOpenOutline, bagRemoveOutline,
  shieldCheckmarkOutline, informationCircleOutline, skullOutline, logOutOutline, closeCircleOutline
})
@Component({
  selector: 'app-settings',
  templateUrl: './settings.component.html',
  styleUrls: ['./settings.component.scss'],
  standalone: true,
  imports: [IonContent, IonIcon, IonHeader, RouterModule]
})
export class SettingsComponent implements OnInit {
  currentUser: CloudUser | undefined;
  constructor(private navCtrl: NavController, private route: Router) {
    this.currentUser = new CloudUser();
  }
  ngOnInit() { }
  /**
   * @返回按钮事件
   */
  goBack() {
    this.navCtrl.back();
  }

  goUserInfo() {
    this.route.navigate(['userInfo']);
  }

  logOut() {
    this.currentUser?.logout();
    console.log('已退出登录');
    this.route.navigate(['tabs/tab3']);
  }

}
