import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { IonicModule } from '@ionic/angular';
import { FormsModule } from '@angular/forms';

@Component({
  selector: 'app-short-generator',
  templateUrl: './short-generator.page.html',
  styleUrls: ['./short-generator.page.scss'],
  standalone: true,
  imports: [IonicModule, FormsModule]
})
export class ShortGeneratorPage implements OnInit {
  workTitle: string = '';
  selectedStyle: string = '';
  characterName: string = '';
  characterGender: string = '';
  characterDescription: string = '';
  characters: Array<{ name: string; gender: string; description: string }> = [];

  constructor() { }

  ngOnInit() { }

  goBack() {
    // 实现返回逻辑，例如使用路由
  }

  onStyleChange() {
    // 处理风格选择变化
  }

  addCharacter() {
    console.log('人物创建:', {
      name: this.characterName,
      gender: this.characterGender,
      description: this.characterDescription
    });
    if (this.characterName && this.characterGender && this.characterDescription) {
      this.characters.push({
        name: this.characterName,
        gender: this.characterGender,
        description: this.characterDescription
      });
    }
    // 清空输入框
    this.characterName = '';
    this.characterGender = '';
    this.characterDescription = '';
  }

}
