import { Component, Input } from '@angular/core';
import { ModalController } from '@ionic/angular';
import { VideoPlayerPage } from './video-player.page';

@Component({
  selector: 'app-course-detail',
  templateUrl: 'course-detail.page.html',
  styleUrls: ['course-detail.page.scss'],
  standalone: false
})
export class CourseDetailPage {
  @Input() course: any;
  
  steps = [
    { name: '热身运动', duration: 120, description: '活动关节，提高心率' },
    { name: '主要训练', duration: 300, description: '重点训练目标肌群' },
    { name: '放松拉伸', duration: 180, description: '缓解肌肉紧张' }
  ];

  constructor(private modalCtrl: ModalController) {}

  dismiss() {
    this.modalCtrl.dismiss();
  }

  async startTraining() {
    const modal = await this.modalCtrl.create({
      component: VideoPlayerPage,
      componentProps: { 
        videoUrl: `assets/videos/course-${this.course.id}.mp4`,
        course: this.course
      }
    });
    await modal.present();
  }
}