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

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

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

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

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

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