import { PageLoadingComponent } from '@/shared/components/page-loading.component';
import { Component, computed, inject, signal } from '@angular/core';
import { ActivatedRoute, RouterOutlet } from '@angular/router';
import { BusinessActivityStore } from '../store/businessActivity.store';

@Component({
  selector: 'businessActivity-layout',
  templateUrl: './layout.component.html',
  imports: [PageLoadingComponent, RouterOutlet],
})
export class BusinessActivityLayoutComponent {
  private readonly route = inject(ActivatedRoute);
  private readonly store = inject(BusinessActivityStore);

  readonly businessId = signal<string>(this.route.snapshot.paramMap.get('businessActivityId')!);

  readonly loading = computed(() => this.store.loading());

  getData() {
    this.store.getData(this.businessId());
  }

  ngOnInit() {
    this.getData();
  }
}
