import { Injectable, Provider } from '@angular/core';
import {
  DB_MODEL_COLUMNS,
  ID_COLUMN,
  PageColumns,
} from 'src/app/core/base/page.columns';
import { TableColumn } from 'src/app/modules/shared/components/table/table.model';
import { Domain } from 'src/app/model/entities/domain';

@Injectable()
export class DomainsColumns extends PageColumns<Domain> {
  get(): TableColumn<Domain>[] {
    return [
      ID_COLUMN,
      {
        name: 'name',
        translationKey: 'common.name',
        type: 'text',
        filterable: true,
        value: (row: Domain) => row.name,
      },
      ...DB_MODEL_COLUMNS,
    ];
  }

  static provide(): Provider[] {
    return [
      {
        provide: PageColumns,
        useClass: DomainsColumns,
      },
      DomainsColumns,
    ];
  }
}
