// import { CatalogRoleTagComponent } from '@/shared/catalog/roles';
import { AbstractList } from '@/shared/abstractClasses/abstract-list';
import {
  IColumn,
  PageDataListComponent,
} from '@/shared/components/pageDataList/page-data-list.component';
import { Component, inject, Input } from '@angular/core';
import { IAccountResponse } from '../../models';
import { AdminUserAccountsService } from '../../services/accounts.service';
import { UserAccountFormComponent } from './form.component';

@Component({
  selector: 'superAdmin-user-account-list',
  templateUrl: './list.component.html',
  imports: [PageDataListComponent, UserAccountFormComponent],
})
export class UsersComponent extends AbstractList<IAccountResponse> {
  @Input() userId!: string;
  @Input() fullHeight?: boolean;
  @Input() header: IColumn[] = [
    { field: 'username', header: 'نام کاربری' },
    { field: 'type', header: 'نوع حساب' },
    {
      field: 'created_at',
      header: 'تاریخ ایجاد',
      type: 'date',
    },
  ];
  private readonly service = inject(AdminUserAccountsService);

  override setColumns(): void {
    this.columns = this.header;
  }

  override getDataRequest() {
    return this.service.getAll(this.userId);
  }
}
