import { Component ,OnInit,CUSTOM_ELEMENTS_SCHEMA} from '@angular/core';
import { IonHeader, IonToolbar, IonTitle, IonContent,IonSearchbar,IonButtons,IonButton,IonIcon,IonMenuButton,IonAvatar,
  IonGrid,IonRow,IonCol,IonCard,IonCardHeader,IonCardContent,IonList,IonItem,IonLabel
 } from '@ionic/angular/standalone';
import { ExploreContainerComponent } from '../explore-container/explore-container.component';
import { NavController } from '@ionic/angular';
import { FormControl } from '@angular/forms';
import { CommonModule } from '@angular/common';
import { Router } from '@angular/router'; // 用于路由导航

@Component({
  selector: 'app-home',
  templateUrl: 'home.page.html',
  styleUrls: ['home.page.scss'],
  standalone: true,
  imports: [
    IonHeader, IonToolbar, IonContent,
    IonButtons,IonButton,IonIcon,IonGrid,IonRow,
    IonCol,IonCard,IonCardHeader,IonCardContent,IonList,IonItem,IonLabel,IonLabel,CommonModule
  ],
  schemas:[CUSTOM_ELEMENTS_SCHEMA]
})
export class HomePage {
  // 定义推荐故事的属性
  recommendedStories = [
    { id: 1, title: '故事一：勇者的冒险' },
    { id: 2, title: '故事二：神秘的森林' },
    { id: 3, title: '故事三：时间的旅行' },
    { id: 4, title: '故事四：遗失的宝藏' },
  ];

  constructor(private router: Router) {} // 构造函数，注入 Router 服务

  // 导航方法
  navigateHome() {
    this.router.navigate(['/']);
  }

  navigateToLogin() {
    this.router.navigate(['/login']);
  }

  navigateToRegister() {
    this.router.navigate(['/register']);
  }

  navigateToGenerate() {
    this.router.navigate(['/tabs/write']);
  }

  navigateToDialogue() {
    this.router.navigate(['/dialogue']);
  }

  navigateToExpand() {
    this.router.navigate(['/expand']);
  }

  navigateToCustomize() {
    this.router.navigate(['/customize']);
  }

  navigateToStory(storyId: number) {
    this.router.navigate(['/story', storyId]);
  }

  navigateToAbout() {
    this.router.navigate(['/about']);
  }

  navigateToHelp() {
    this.router.navigate(['/help']);
  }

  navigateToContact() {
    this.router.navigate(['/contact']);
  }
}