// 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 { IPartnerAccountResponse } from '../../models';
import { AdminPartnerAccountsService } from '../../services/accounts.service';
import { PartnerAccountFormComponent } from './form.component';

@Component({
  selector: 'superAdmin-partner-account-list',
  templateUrl: './list.component.html',
  imports: [PageDataListComponent, PartnerAccountFormComponent],
})
export class ConsumerAccountListComponent extends AbstractList<IPartnerAccountResponse> {
  @Input({ required: true }) partnerId!: string;
  @Input() fullHeight?: boolean;
  @Input() header: IColumn[] = [
    // { field: 'id', header: 'شناسه', type: 'id' },
    {
      field: 'username',
      header: 'نام کاربری',
      type: 'nested',
      nestedOption: { path: 'account.username' },
    },
    { field: 'role', header: 'نوع حساب' },
    {
      field: 'status',
      header: 'وضعیت',
      type: 'nested',
      nestedOption: { path: 'account.status' },
    },
    {
      field: 'created_at',
      header: 'تاریخ ایجاد',
      type: 'date',
    },
  ];
  private readonly service = inject(AdminPartnerAccountsService);

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

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