import * as _masterteam_components_table from '@masterteam/components/table';
import * as _angular_core from '@angular/core';
import { TemplateRef } from '@angular/core';
import { MTIcon } from '@masterteam/icons';
import { ConfirmationConfig, ConfirmationService } from '@masterteam/components/confirmation';
import { Table as Table$1, TablePageEvent } from 'primeng/table';
import { EntityData } from '@masterteam/components/entities';
import { ControlValueAccessor } from '@angular/forms';

/**
 * Table action confirmation config with optional event
 */
type TableActionConfirmationConfig = Omit<ConfirmationConfig, 'event'> & {
    event?: Event;
    confirmationType?: 'delete';
};
/**
 * Defines the options for a select filter.
 */
interface FilterOption {
    label: string;
    value: any;
}
/**
 * Configuration for filtering on a specific column.
 */
interface FilterConfig {
    type: 'text' | 'select' | 'date' | 'boolean' | 'user';
    label?: string;
    options?: FilterOption[];
    [key: string]: unknown;
}
/**
 * Filter value for date range or simple value
 */
interface FilterValue {
    value?: any;
    from?: Date | null;
    to?: Date | null;
}
/**
 * Table filters map
 */
type TableFilters = Record<string, FilterValue | any>;
/**
 * Column type definition
 */
type ColumnType = 'text' | 'boolean' | 'date' | 'user' | 'status' | 'entity' | 'custom';
/**
 * Event emitted when a cell value changes
 */
interface CellChangeEvent {
    row: any;
    column: string;
    value: any;
    type: ColumnTypeForActionCell;
}
type ColumnTypeForActionCell = 'boolean';
type TableActionShape = 'flat' | 'popover';
interface ColumnDef {
    key: string;
    label: string;
    type?: ColumnType;
    customCellTpl?: TemplateRef<any>;
    filterConfig?: FilterConfig;
    readonly?: boolean;
}
interface TableAction {
    icon?: MTIcon | undefined;
    color?: 'info' | 'success' | 'warn' | 'danger' | 'secondary' | 'contrast' | 'help' | 'primary';
    variant?: 'text' | 'outlined' | undefined;
    label?: string;
    tooltip?: string;
    hidden?: (row: any) => boolean;
    action: (row: any) => void;
    loading?: (row: any) => boolean;
    confirmation?: TableActionConfirmationConfig;
}

declare class Table {
    selectionChange: _angular_core.OutputEmitterRef<any[]>;
    cellChange: _angular_core.OutputEmitterRef<CellChangeEvent>;
    lazyLoad: _angular_core.OutputEmitterRef<any>;
    columnReorder: _angular_core.OutputEmitterRef<any>;
    rowReorder: _angular_core.OutputEmitterRef<any>;
    rowClick: _angular_core.OutputEmitterRef<any>;
    filters: _angular_core.ModelSignal<TableFilters>;
    data: _angular_core.InputSignal<any[]>;
    columns: _angular_core.InputSignal<ColumnDef[]>;
    rowActions: _angular_core.InputSignal<TableAction[]>;
    size: _angular_core.InputSignal<"small" | "large" | undefined>;
    showGridlines: _angular_core.InputSignalWithTransform<boolean, unknown>;
    stripedRows: _angular_core.InputSignalWithTransform<boolean, unknown>;
    selectableRows: _angular_core.InputSignalWithTransform<boolean, unknown>;
    clickableRows: _angular_core.InputSignalWithTransform<boolean, unknown>;
    generalSearch: _angular_core.InputSignalWithTransform<boolean, unknown>;
    showFilters: _angular_core.InputSignalWithTransform<boolean, unknown>;
    loading: _angular_core.InputSignalWithTransform<boolean, unknown>;
    updating: _angular_core.InputSignalWithTransform<boolean, unknown>;
    lazy: _angular_core.InputSignalWithTransform<boolean, unknown>;
    lazyTotalRecords: _angular_core.InputSignal<number | undefined>;
    reorderableColumns: _angular_core.InputSignalWithTransform<boolean, unknown>;
    reorderableRows: _angular_core.InputSignalWithTransform<boolean, unknown>;
    dataKey: _angular_core.InputSignal<string | undefined>;
    exportable: _angular_core.InputSignalWithTransform<boolean, unknown>;
    exportFilename: _angular_core.InputSignal<string>;
    actionShape: _angular_core.InputSignal<TableActionShape>;
    tabs: _angular_core.InputSignal<any[] | undefined>;
    tabsOptionLabel: _angular_core.InputSignal<string | undefined>;
    tabsOptionValue: _angular_core.InputSignal<string | undefined>;
    activeTab: _angular_core.ModelSignal<any>;
    onTabChange: _angular_core.OutputEmitterRef<any>;
    actions: _angular_core.InputSignal<TableAction[]>;
    captionStartContent: _angular_core.Signal<TemplateRef<any> | undefined>;
    captionEndContent: _angular_core.Signal<TemplateRef<any> | undefined>;
    emptyContent: _angular_core.Signal<TemplateRef<any> | undefined>;
    protected tableRef: _angular_core.Signal<Table$1<any> | undefined>;
    paginatorPosition: _angular_core.InputSignal<"end" | "start" | "center">;
    pageSize: _angular_core.ModelSignal<number>;
    currentPage: _angular_core.ModelSignal<number>;
    first: _angular_core.ModelSignal<number>;
    filterTerm: _angular_core.ModelSignal<string>;
    confirmationService: ConfirmationService;
    protected selectedRows: _angular_core.WritableSignal<Set<any>>;
    protected exportColumns: _angular_core.Signal<{
        field: string;
        header: string;
        key: string;
        label: string;
        type?: _masterteam_components_table.ColumnType;
        customCellTpl?: TemplateRef<any>;
        filterConfig?: _masterteam_components_table.FilterConfig;
        readonly?: boolean;
    }[]>;
    protected activeFilterCount: _angular_core.Signal<number>;
    protected filteredData: _angular_core.Signal<any[]>;
    protected displayData: _angular_core.Signal<any[]>;
    protected totalRecords: _angular_core.Signal<number>;
    protected paginatedData: _angular_core.Signal<any[]>;
    protected allSelectedOnPage: _angular_core.Signal<boolean>;
    onFilterApplied(filters: TableFilters): void;
    onFilterReset(): void;
    protected matchesFilter(item: any, key: string, filterValue: FilterValue | any): boolean;
    toggleRow(row: any): void;
    toggleAllRowsOnPage(): void;
    getProperty(obj: any, key: string): any;
    getEntityPreviewData(row: any, col: ColumnDef): EntityData | null;
    tabChanged(tab: any): void;
    onTablePage(event: TablePageEvent): void;
    handleLazyLoad(event: any): void;
    onPaginatorPage(event: any): void;
    onSearchChange(searchTerm: string): void;
    onCellChange(row: any, columnKey: string, newValue: any, type?: ColumnTypeForActionCell): void;
    resolveActionLoading(action: TableAction, row: any): boolean | undefined;
    getVisibleRowActions(row: any): TableAction[];
    onColumnReorder(event: any): void;
    onRowReorder(event: any): void;
    onRowClick(event: MouseEvent, row: any): void;
    protected updatePagingFromEvent(event: any): void;
    protected emitLazyLoad(event: any): void;
    exportCSV(): void;
    rowAction(event: Event, action: TableAction, row: any): void;
    private buildUserEntityData;
    private buildStatusEntityData;
    /**
     * Gets the entity data for an 'entity' type column.
     * The row data is expected to already be in EntityData format.
     * Automatically hides entity name and configures User entities
     * to show only avatar + displayName.
     */
    getEntityColumnData(row: any, col: ColumnDef): EntityData | null;
    static ɵfac: _angular_core.ɵɵFactoryDeclaration<Table, never>;
    static ɵcmp: _angular_core.ɵɵComponentDeclaration<Table, "mt-table", never, { "filters": { "alias": "filters"; "required": false; "isSignal": true; }; "data": { "alias": "data"; "required": true; "isSignal": true; }; "columns": { "alias": "columns"; "required": true; "isSignal": true; }; "rowActions": { "alias": "rowActions"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "showGridlines": { "alias": "showGridlines"; "required": false; "isSignal": true; }; "stripedRows": { "alias": "stripedRows"; "required": false; "isSignal": true; }; "selectableRows": { "alias": "selectableRows"; "required": false; "isSignal": true; }; "clickableRows": { "alias": "clickableRows"; "required": false; "isSignal": true; }; "generalSearch": { "alias": "generalSearch"; "required": false; "isSignal": true; }; "showFilters": { "alias": "showFilters"; "required": false; "isSignal": true; }; "loading": { "alias": "loading"; "required": false; "isSignal": true; }; "updating": { "alias": "updating"; "required": false; "isSignal": true; }; "lazy": { "alias": "lazy"; "required": false; "isSignal": true; }; "lazyTotalRecords": { "alias": "lazyTotalRecords"; "required": false; "isSignal": true; }; "reorderableColumns": { "alias": "reorderableColumns"; "required": false; "isSignal": true; }; "reorderableRows": { "alias": "reorderableRows"; "required": false; "isSignal": true; }; "dataKey": { "alias": "dataKey"; "required": false; "isSignal": true; }; "exportable": { "alias": "exportable"; "required": false; "isSignal": true; }; "exportFilename": { "alias": "exportFilename"; "required": false; "isSignal": true; }; "actionShape": { "alias": "actionShape"; "required": false; "isSignal": true; }; "tabs": { "alias": "tabs"; "required": false; "isSignal": true; }; "tabsOptionLabel": { "alias": "tabsOptionLabel"; "required": false; "isSignal": true; }; "tabsOptionValue": { "alias": "tabsOptionValue"; "required": false; "isSignal": true; }; "activeTab": { "alias": "activeTab"; "required": false; "isSignal": true; }; "actions": { "alias": "actions"; "required": false; "isSignal": true; }; "paginatorPosition": { "alias": "paginatorPosition"; "required": false; "isSignal": true; }; "pageSize": { "alias": "pageSize"; "required": false; "isSignal": true; }; "currentPage": { "alias": "currentPage"; "required": false; "isSignal": true; }; "first": { "alias": "first"; "required": false; "isSignal": true; }; "filterTerm": { "alias": "filterTerm"; "required": false; "isSignal": true; }; }, { "selectionChange": "selectionChange"; "cellChange": "cellChange"; "lazyLoad": "lazyLoad"; "columnReorder": "columnReorder"; "rowReorder": "rowReorder"; "rowClick": "rowClick"; "filters": "filtersChange"; "activeTab": "activeTabChange"; "onTabChange": "onTabChange"; "pageSize": "pageSizeChange"; "currentPage": "currentPageChange"; "first": "firstChange"; "filterTerm": "filterTermChange"; }, ["captionStartContent", "captionEndContent", "emptyContent"], never, true, never>;
}

declare class TableFilter implements ControlValueAccessor {
    readonly columns: _angular_core.InputSignal<ColumnDef[]>;
    readonly data: _angular_core.InputSignal<any[]>;
    readonly filterApplied: _angular_core.OutputEmitterRef<TableFilters>;
    readonly filterReset: _angular_core.OutputEmitterRef<void>;
    protected pendingFilters: _angular_core.WritableSignal<TableFilters>;
    protected appliedFilters: _angular_core.WritableSignal<TableFilters>;
    protected booleanOptions: {
        label: string;
        value: boolean;
    }[];
    private onChange;
    private onTouched;
    protected filterableColumns: _angular_core.Signal<ColumnDef[]>;
    protected activeFilterCount: _angular_core.Signal<number>;
    protected getFilterType(col: ColumnDef): string;
    protected getFilterValue(key: string): any;
    protected getDateRangeValue(key: string, part: 'from' | 'to'): Date | null;
    protected updateFilter(key: string, value: any): void;
    protected updateDateFilter(key: string, part: 'from' | 'to', value: Date | null): void;
    protected apply(): void;
    protected reset(): void;
    private hasValue;
    writeValue(value: TableFilters | null): void;
    registerOnChange(fn: (value: TableFilters) => void): void;
    registerOnTouched(fn: () => void): void;
    static ɵfac: _angular_core.ɵɵFactoryDeclaration<TableFilter, never>;
    static ɵcmp: _angular_core.ɵɵComponentDeclaration<TableFilter, "mt-table-filter", never, { "columns": { "alias": "columns"; "required": true; "isSignal": true; }; "data": { "alias": "data"; "required": false; "isSignal": true; }; }, { "filterApplied": "filterApplied"; "filterReset": "filterReset"; }, never, never, true, never>;
}

export { Table, TableFilter };
export type { CellChangeEvent, ColumnDef, ColumnType, ColumnTypeForActionCell, FilterConfig, FilterOption, FilterValue, TableAction, TableActionConfirmationConfig, TableActionShape, TableFilters };
