/**
 * Copyright 2024 Phenix Real Time Solutions, Inc. Confidential and Proprietary. All Rights Reserved.
 */
import React from 'react';
import {ISelectComponent} from 'components/ui/select';

export enum DirectionType {
  Asc = 'ASC',
  Desc = 'DESC',
  Unsort = 'UNSORT'
}

export enum TableHeaderKey {
  Search = 'search',
  SelectKeys = 'selectKeys',
  SelectType = 'selectType',
  AddRow = 'addRow',
  Refresh = 'refresh',
  ExportCSV = 'exportCSV'
}

interface ICommonTableHeader {
  [TableHeaderKey.Search]?: {
    searchProps?: string[];
  };
}

export interface ITableWithPaginationHeader extends ICommonTableHeader {
  [TableHeaderKey.AddRow]?: {
    openAddRowModal: () => void;
  };
  [TableHeaderKey.SelectType]?: ISelectComponent;
}

export interface ITableWithLoadMoreHeader extends ICommonTableHeader {
  [TableHeaderKey.Refresh]?: {
    onClick: () => void;
    isFetching?: boolean;
  };
  [TableHeaderKey.SelectKeys]?: {
    modalLabel?: string;
  };
  [TableHeaderKey.ExportCSV]?: {
    render: () => React.JSX.Element;
  };
}

export interface ITableSort {
  sortColumn: string;
  sortDirection: DirectionType;
}

export interface ITableSearch {
  searchValue: string;
}

export type ITableSortSearch = ITableSort & ITableSearch;
