import { MaterialTableColumnProps } from '../material-table/material-table';
import { IPaginationModel } from '../../@types/pagination-model';
import { PageState } from '../../contexts/page-context';

export interface IRowAction {
    label: string;
    handleAction: (row: any) => void;
    disabled?: (row: any) => boolean;
}
export interface IListingComponentProps {
    title: string;
    activePage: PageState;
    updatePageInfo: (info: Partial<PageState>) => void;
    rows: any[];
    isLoading: boolean;
    paginationModel: IPaginationModel;
    totalCount: number;
    tableColumns: MaterialTableColumnProps[];
    columnOrder?: string[];
    rowActionMenu?: IRowAction[];
    destructiveActionMenu?: IRowAction[];
    handleAddButton?: () => void;
    searchText?: string;
    handleSearch?: (search: string) => void;
    disabledViews?: string[];
    fields?: any[];
    selectedIds?: string[];
    pageName?: string;
    importModuleName?: string;
    showAddButton?: boolean;
    actionButtons?: React.ReactNode[];
    handlePaginationModel: (model: IPaginationModel) => void;
    paginationResource?: string;
    enablePages?: boolean;
    GridComponent?: React.ReactNode | React.ComponentType<{
        data: any[];
    }>;
    onSelectRow?: (selectedRows: any[]) => void;
    onColumnOrdering?: (colOrder: string[]) => void;
    onColumnVisibility?: (columns: MaterialTableColumnProps[]) => void;
    onSortingChange?: (sort: any) => void;
    fallbackIcon?: React.ReactNode;
    className?: string;
    onDeleteConfirm?: (item: any) => Promise<void> | void;
    deleteTitle?: string;
    deleteDescription?: (item: any) => string;
    fetchApi?: any;
    resetState?: any;
    setPaginationModel?: (model: IPaginationModel) => void;
    storeName?: string;
    deleteApi?: any;
    isUseFields?: boolean;
    customFields?: any[];
    customeFilter?: string;
    showCreatedBy?: boolean;
}
export interface IListingState {
    selectedRows: string[];
    itemToDelete: any | null;
    isDeleting: boolean;
}
