import { Component, EventEmitter, Input, Output } from '@angular/core';

@Component({
  selector: 'risk-type-category-nav',
  standalone: true,
  imports: [],
  templateUrl: './risk-type-category-nav.component.html',
  styleUrl: './risk-type-category-nav.component.less',
})
export class RiskTypeCategoryNavComponent {
  @Input() emptyAbleToSelect = false;
  @Input() showCount = true;
  @Input() types: OptionWithCount<number>[] = [];
  @Input() categories: OptionWithCount<number>[] = [];
  @Input() selectedType = -1;
  @Input() selectedCategory = -1;

  @Output() selectedTypeChange = new EventEmitter<number>();
  @Output() selectedCategoryChange = new EventEmitter<number>();

  constructor() {}

  changeType(op: OptionWithCount<number>) {
    if (!op.count && !this.emptyAbleToSelect) return;
    this.selectedTypeChange.emit(op.value);
  }
  changeCategory(op: OptionWithCount<number>) {
    if (!op.count && !this.emptyAbleToSelect) return;
    this.selectedCategoryChange.emit(op.value);
  }
}
