// import { CatalogRoleTagComponent } from '@/shared/catalog/roles';
import { AbstractList } from '@/shared/abstractClasses/abstract-list';
import { PageDataListComponent } from '@/shared/components/pageDataList/page-data-list.component';
import { consumerListConfig } from '@/shared/constants/list-configs';
import { Component, inject } from '@angular/core';
import { Router } from '@angular/router';
import { ConsumerUserFormComponent } from '../components/form.component';
import { superAdminConsumersNamedRoutes } from '../constants';
import { IAdminConsumerResponse } from '../models';
import { ConsumersService } from '../services/main.service';

@Component({
  selector: 'superAdmin-consumers',
  templateUrl: './list.component.html',
  imports: [PageDataListComponent, ConsumerUserFormComponent],
})
export class ConsumersComponent extends AbstractList<IAdminConsumerResponse> {
  private readonly service = inject(ConsumersService);
  private readonly router = inject(Router);

  override setColumns(): void {
    this.columns = consumerListConfig.columns;
  }
  override getDataRequest() {
    return this.service.getAll();
  }

  toSinglePage(consumer: IAdminConsumerResponse) {
    this.router.navigateByUrl(superAdminConsumersNamedRoutes.consumer.meta.pagePath!(consumer.id));
  }
}
