import type { ColumnDefinition, CellComponent } from 'tabulator-tables';
import type { FeatureStatus } from '../../common/feature-status-config.js';
import type { FeatureNodeState } from '../../common/feature-node/feature-node-state-config.js';
import './feature-tree-table.css';
export interface FeatureTreeRow {
    id: string;
    name: string;
    status: FeatureStatus;
    lifecycle: string;
    branch: string;
    repositoryName: string;
    remoteUrl?: string;
    parentId?: string;
    /** Internal: child rows for tree hierarchy */
    _children?: FeatureTreeRow[];
    /** Internal: whether this row is a group header */
    _isGroupHeader?: boolean;
    /** Internal: number of features in this group */
    _groupCount?: number;
    /** Internal: whether this row is a repository group header (legacy tree) */
    _isRepoGroup?: boolean;
    /** Internal: number of features in this repo group (legacy tree) */
    _featureCount?: number;
    /** Repository path for the repo this row belongs to (used to create features from repo groups) */
    _repositoryPath?: string;
    /** Repository ID (used for sync and deploy actions on repo group headers) */
    _repositoryId?: string;
    /** Derived UI node state for action mapping (9-state model from derive-feature-state) */
    nodeState?: FeatureNodeState;
    /** Whether this feature has child features (for delete dialog cascade option) */
    hasChildren?: boolean;
    /** Whether this feature has an open pull request (for delete dialog close-PR option) */
    hasOpenPr?: boolean;
    /** Whether this row represents an application instead of a feature */
    _isApplication?: boolean;
    /** Real application id (without the `app-` prefix used for table row id) */
    _applicationId?: string;
    /** Optional cloud preview URL for application rows */
    _applicationCloudUrl?: string;
}
export interface InventoryRepo {
    name: string;
    remoteUrl?: string;
}
export type GroupByField = 'repositoryName' | 'status' | 'lifecycle';
export type SortDir = 'asc' | 'desc';
export interface FeatureTreeTableProps {
    data: FeatureTreeRow[];
    repos?: InventoryRepo[];
    className?: string;
    /** Called when a clickable row (feature or application) is clicked. */
    onRowClick?: (row: FeatureTreeRow) => void;
    /** When set, features are grouped into a tree by this field. */
    groupBy?: GroupByField | null;
    /** Sort direction for group headers. */
    groupSortDir?: SortDir;
    /** Field to sort items within each group (or globally in flat mode). */
    itemSortField?: string;
    /** Sort direction for items. */
    itemSortDir?: SortDir;
    /** Called when the table renders/re-renders with a ref to the container, for portal management. */
    onTableRender?: (container: HTMLDivElement) => void;
    /** Called when the (+) button on a repo group header is clicked, with the repository path. */
    onCreateFeatureForRepo?: (repositoryPath: string) => void;
}
export declare const ACTIONS_COLUMN_FIELD = "_actions";
/**
 * Tabulator custom formatter for the actions column.
 * Creates a portal target div with data-feature-id for regular rows.
 * Returns empty string for group header rows (no actions on headers).
 */
export declare function actionsColumnFormatter(cell: CellComponent): string | HTMLElement;
interface ColumnConfig {
    onRowClick?: (row: FeatureTreeRow) => void;
    groupBy?: GroupByField | null;
}
/** All possible columns. We'll filter out the grouped-by column in tree mode. */
export declare function buildColumns({ onRowClick, groupBy }: ColumnConfig): ColumnDefinition[];
export declare function displayLabel(groupBy: GroupByField, value: string): string;
/**
 * Build tree-structured data grouped by repository (legacy format).
 * Each repository becomes a parent node with its features as children.
 * Repos without features are included as empty groups.
 */
export declare function buildTreeData(flatData: FeatureTreeRow[], repos?: InventoryRepo[]): FeatureTreeRow[];
export declare function buildGroupedTree(flatData: FeatureTreeRow[], groupBy: GroupByField, groupSortDir: SortDir, itemSortField: string, itemSortDir: SortDir): FeatureTreeRow[];
export declare function FeatureTreeTable({ data, className, onRowClick, groupBy, groupSortDir, itemSortField, itemSortDir, onTableRender, onCreateFeatureForRepo, }: FeatureTreeTableProps): import("react/jsx-runtime").JSX.Element;
export {};
//# sourceMappingURL=feature-tree-table.d.ts.map