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

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

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

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

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

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