import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
import { ApplicationService } from '@core/application';
import { Breadcrumb, BreadcrumbService } from '@core/breadcrumb';
import { Config } from '@core/config';

@Component({
  selector: 'page-package-inspection',
  templateUrl: './package-inspection.component.html',
  styleUrls: ['./package-inspection.component.css'],
  changeDetection: ChangeDetectionStrategy.OnPush,
  standalone: false,
})
export class PackageInspectionComponent implements OnInit {
  get breadcrumbKey(): string {
    return this._config.get('process.ids.packageInspection');
  }

  constructor(
    private _config: Config,
    private _breadcrumb: BreadcrumbService,
  ) {}

  ngOnInit(): void {
    this.createBreadcrumbIfNotExists();
  }

  async createBreadcrumbIfNotExists(): Promise<void> {
    const crumb: Breadcrumb = {
      key: this.breadcrumbKey,
      name: 'Packstück Prüfung',
      path: '/filiale/package-inspection',
      section: 'branch',
      tags: ['main'],
    };

    await this._breadcrumb.addBreadcrumbIfNotExists(crumb);
  }
}
