import { Component, EventEmitter, Input, Output } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
import { faStar, faClock, faPlus, faCheck } from '@fortawesome/free-solid-svg-icons';
import { MenuItem } from '../../models/menu-item.model';

@Component({
  selector: 'app-menu-card',
  standalone: true,
  imports: [CommonModule, FontAwesomeModule],
  templateUrl: './menu-card.component.html',
  styleUrls: ['./menu-card.component.scss']
})
export class MenuCardComponent {
  @Input() menuItem!: MenuItem;
  @Output() viewCulture = new EventEmitter<MenuItem>();
  @Output() addToCart = new EventEmitter<MenuItem>();
  
  // Font Awesome 图标
  faStar = faStar;
  faClock = faClock;
  faPlus = faPlus;
  faCheck = faCheck;
  
  isAdded = false;
  
  onAddToCart() {
    this.isAdded = true;
    this.addToCart.emit(this.menuItem);
    
    setTimeout(() => {
      this.isAdded = false;
    }, 1500);
  }
}