import { UpperCasePipe } from '@angular/common';
import { Component, computed, inject, input } from '@angular/core';

import { findMenu } from '../../../../core/services/menu.utils';
import { TenantService } from '../../../../core/services/tenant.service';

@Component({
  selector: 'app-menu-content-section',
  imports: [UpperCasePipe],
  templateUrl: './menu-content-section.component.html',
  styleUrl: './menu-content-section.component.scss',
})
export class MenuContentSectionComponent {
  private readonly tenantService = inject(TenantService);

  readonly menuCode = input.required<string>();
  readonly titleId = input.required<string>();

  protected readonly title = computed(
    () => findMenu(this.tenantService.tenant()?.menues ?? [], this.menuCode())?.label ?? '',
  );
}
