import { AbstractList } from '@/shared/abstractClasses/abstract-list';
import { PageDataListComponent } from '@/shared/components/pageDataList/page-data-list.component';
import { Component, inject } from '@angular/core';
import { StockKeepingUnitFormComponent } from '../components/form.component';
import { IStockKeepingUnitResponse } from '../models';
import { StockKeepingUnitsService } from '../services/main.service';

@Component({
  selector: 'superAdmin-stockKeepingUnits',
  templateUrl: './list.component.html',
  imports: [PageDataListComponent, StockKeepingUnitFormComponent],
})
export class StockKeepingUnitsComponent extends AbstractList<IStockKeepingUnitResponse> {
  private readonly service = inject(StockKeepingUnitsService);

  override setColumns(): void {
    this.columns = [
      { field: 'code', header: 'کد' },
      { field: 'name', header: 'عنوان' },
      { field: 'VAT', header: 'مالیات ارزش افزوده' },
      { field: 'type', header: 'نوع' },
    ];
  }

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