import { Component, Input, Output, EventEmitter } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
import { faCheck } from '@fortawesome/free-solid-svg-icons';

@Component({
  selector: 'app-suggestion-item',
  standalone: true,
  imports: [CommonModule, FontAwesomeModule],
  templateUrl: './suggestion-item.component.html',
  styleUrls: ['./suggestion-item.component.scss']
})
export class SuggestionItemComponent {
  @Input() suggestion: any;
  @Output() replace = new EventEmitter<void>();

  faCheck = faCheck;
  isReplaced = false;

  onReplace(): void {
    this.isReplaced = true;
    this.replace.emit();
    
    setTimeout(() => {
      this.isReplaced = false;
    }, 2000);
  }
}