// import { CatalogRoleTagComponent } from '@/shared/catalog/roles';
import { AbstractList } from '@/shared/abstractClasses/abstract-list';
import { PageDataListComponent } from '@/shared/components/pageDataList/page-data-list.component';
import { Component, inject, Input } from '@angular/core';
import { IPartnerChargeLicenseTransactionRawResponse } from '../../models';
import { AdminPartnerChargeLicenseTransactionsService } from '../../services/chargeLicenseTransactions.service';

@Component({
  selector: 'admin-partner-chargeLicenseTransaction-list',
  templateUrl: './list.component.html',
  imports: [PageDataListComponent],
})
export class AdminPartnerChargeLicenseTransactionListComponent extends AbstractList<IPartnerChargeLicenseTransactionRawResponse> {
  @Input({ required: true }) partnerId!: string;

  private readonly service = inject(AdminPartnerChargeLicenseTransactionsService);

  override setColumns(): void {
    this.columns = [
      { field: 'tracking_code', header: 'کد پیگیری' },
      { field: 'charged_license_count', header: 'لایسنس خریداری شده', type: 'number' },
      { field: 'remained_license_count', header: 'لایسنس باقی‌مانده', type: 'number' },
      {
        field: 'activation_count',
        header: 'لایسنس فروخته شده',
        type: 'number',
      },
      {
        field: 'activation_expires_at',
        header: 'تاریخ انقضا فروش',
        type: 'date',
        dateOption: {
          expiredMode: true,
        },
      },
    ];
  }

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