import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core';
import { SearchSuggestion } from '../../../../../core/search/models/search.model';
import { SearchBarComponent } from '../../../../search/components/search-bar/search-bar.component';

@Component({
  selector: 'app-catalog-search-box',
  standalone: true,
  imports: [SearchBarComponent],
  templateUrl: './search-box.component.html',
  styleUrls: ['./search-box.component.scss'],
  changeDetection: ChangeDetectionStrategy.OnPush
})
export class CatalogSearchBoxComponent {
  @Input() query = '';
  @Input() loading = false;
  @Input() suggestions: SearchSuggestion[] = [];
  @Input() recentSearches: string[] = [];
  @Input() popularSearches: string[] = [];
  @Input() searchHistory: string[] = [];
  @Input() noResults = false;

  @Output() queryChange = new EventEmitter<string>();
  @Output() searchSubmit = new EventEmitter<string>();
  @Output() suggestionSelected = new EventEmitter<SearchSuggestion>();
  @Output() recentSelected = new EventEmitter<string>();
  @Output() historyCleared = new EventEmitter<void>();
}
