import { DefineComponent } from 'vue';
import { FilterField } from '@/types/filterField.type';
import { QueryParams } from '../DataTable/DataTable.vue.d';

export type AssetFilterFields =
  | 'name'
  | 'assetValue'
  | 'category'
  | 'brand'
  | 'model'
  | 'tagType'
  | 'group'
  | 'maintenanceAuditStatus'
  | 'isTransactionable'
  | 'measurement'
  | 'lastScannedAt'
  | 'warrantyStatus'
  | 'customField';

export interface AssetFilterQuery extends QueryParams {
  name?: string[];
  brand?: string[];
  model?: string[];
  tagType?: string[];
  maintenanceAuditStatus?: string[];
  isTransactionable?: boolean[];
  audit?: string[];
  maintenance?: string[];
  measurement?: string[];
  warrantyStatus?: string[];
  category?: string[];
  group?: string[];
  lastScannedAt?: number[];
  linkedAssetCount?: number[];
}

export interface AssetFilterProps {
  /**
   * The filter object.
   */
  filter: AssetFilterQuery;
  /*
   * The columns set as visible by the user. Used to determine which filters to show.
   */
  visibleColumns: Record<string, boolean> | undefined;
  /*
   * The name of the table attached to the filter.
   */
  tableName: string;
  fetchOptions: FilterField<QueryParams>['fetchOptionFn'];
  /*
   * The list of filter fields to show.
   */
  showFields?: AssetFilterFields[];
  /*
   * The list of filter fields to hide. This has a higher priority than `showFields`.
   */
  hideFields?: AssetFilterFields[];
  /**
   * To determine the tag type options
   */
  tagType?: 'RFID' | 'QR' | 'RFID & QR';
}

export type AssetFilterEmits = {
  /*
   * Used to update the filter container's key.
   */
  updateFields: [];
};

declare const AssetFilters: DefineComponent<AssetFilterProps, AssetFilterEmits>;

export default AssetFilters;
