import { PageLoadingComponent } from '@/shared/components/page-loading.component';
import pageParamsUtils from '@/utils/page-params.utils';
import { Component, computed, inject, signal } from '@angular/core';
import { ActivatedRoute, RouterOutlet } from '@angular/router';
import { UserStore } from '../store/user.store';

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

  readonly pageParams = computed(() => pageParamsUtils(this.route));
  readonly userId = signal<string>(this.route.snapshot.paramMap.get('userId')!);

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

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

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