import { ChangeDetectionStrategy, Component, input, output } from '@angular/core';

export interface BreadcrumbItem {
  id: string | number;
  label: string;
}

/**
 * Generic breadcrumb trail. Consumer owns navigation - this component only
 * renders the trail and emits which item was clicked (root or a trail item).
 */
@Component({
  selector: 'app-breadcrumb',
  standalone: true,
  templateUrl: './breadcrumb.component.html',
  styleUrl: './breadcrumb.component.scss',
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class BreadcrumbComponent {
  readonly rootLabel = input.required<string>();
  readonly items = input<BreadcrumbItem[]>([]);
  readonly ariaLabel = input<string>('');

  readonly rootClick = output<void>();
  readonly itemClick = output<BreadcrumbItem>();
}
