import { ReactElement, ReactNode, RefObject } from 'react';
import { AiMarkWithTooltipOrPopoverProps, CheckState } from '../../types';
import { SelectFieldOption, SelectFieldProps } from '../../components/SelectField/types';
import { AddNewItemProps } from './addNewItemTypes';
import { ResolvedConfirmation } from './confirmationTypes';
/**
 * Metadata about list sections for rendering purposes.
 * Used by SelectOptions, MultiSelectOptions, and their Menu counterparts to render section headers and dividers.
 * @property type - The type of section ("pinned" for pinned options, "group" for grouped options)
 * @property label - Section label (e.g., "Recent", "Favorites", or group name)
 * @property startIndex - Index in items where this section starts
 * @property endIndex - Index where this section ends (exclusive)
 * @property loading - Whether this section is still loading its options (pinned sections only)
 */
export type SectionMeta = {
    type: "pinned" | "group";
    label: string;
    startIndex: number;
    endIndex: number;
    loading?: boolean;
};
export type SelectFieldBaseInternalProps = {
    id: string;
    helperUid: string;
    selectedOption: SelectFieldOption | null;
    onSelectedOptionChange: (option: SelectFieldOption | null) => void;
    displayAs: "popover" | "dialog";
    isDisabledOrReadOnly: boolean;
    disabled?: boolean;
    readOnly?: boolean;
    isHighlighted?: boolean;
    required?: boolean;
    placeholder?: string;
    size?: "small" | "medium" | "large";
    error?: boolean | string | ReactElement | string[];
    hasHelperText: boolean;
    disableClearButton: boolean;
    prefix?: string | ReactElement;
    suffix?: string | ReactElement;
    label: string;
    hideLabel?: boolean;
    hint?: ReactElement | string;
    moreInfo?: ReactNode;
    moreInfoId?: string;
    labelAiMark?: AiMarkWithTooltipOrPopoverProps["aiMark"];
    errorMessages?: string | ReactElement | string[];
    warning?: string | string[];
    description?: ReactElement | string;
    className?: string;
    style?: React.CSSProperties;
    layoutStyles?: React.CSSProperties;
    pinned?: SelectFieldProps["pinned"];
    groupToString?: (groupValue: string | number) => string;
    groupSorter?: (a: string | number, b: string | number) => number;
    virtualize?: boolean;
    options: SelectFieldOption[];
    loading: boolean;
    loadingMore: boolean;
    hasMore: boolean;
    loadOptions: (searchValue: string, opts?: {
        initial?: boolean;
    }) => Promise<void>;
    loadMore: (searchValue: string) => Promise<void>;
    initialLoad: "immediate" | "open";
    initialLoadPerformed: boolean;
    setInitialLoadPerformed: (val: boolean) => void;
    inputWrapperRef: RefObject<HTMLDivElement>;
    confirmation?: ResolvedConfirmation;
} & AddNewItemProps;
export type SelectFieldComboboxInternalProps = SelectFieldBaseInternalProps & {
    debounceMs: number;
};
/**
 * Loose prop getter types compatible with both downshift's useCombobox and useSelect.
 * Using `any` for the return types is intentional: the actual runtime shapes are identical
 * between the two hooks, but their compile-time generic types diverge.
 */
export type GetMenuPropsFn = (...args: any[]) => any;
export type GetItemPropsFn = (...args: any[]) => any;
export type GetLabelPropsFn = (...args: any[]) => any;
export type SelectItem = {
    id: string | number;
    type: "option" | "pinned-option" | "grouped-option" | "select-all" | "select-filtered";
    original: SelectFieldOption;
    disabled?: boolean;
    checkState?: CheckState;
};
