import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core';
import { Category } from '../../../../../core/categories/models/category-domain.model';
import { TranslatePipe } from '../../../../../i18n/translate.pipe';

@Component({
  selector: 'app-catalog-category-grid',
  standalone: true,
  imports: [TranslatePipe],
  templateUrl: './category-grid.component.html',
  styleUrls: ['./category-grid.component.scss'],
  changeDetection: ChangeDetectionStrategy.OnPush
})
export class CatalogCategoryGridComponent {
  @Input({ required: true }) categories: Category[] = [];

  @Output() categorySelected = new EventEmitter<Category>();

  trackByCategoryId(_index: number, category: Category): number {
    return category.id;
  }
}
