import { DataSourceContextProps, DataSourceContextType } from '../dataSourceComponents/provider/dataSource/DataSourceContext';
import { Result } from 'ahooks/es/useRequest/src/types';
import { TableProps as AntdTableProps, PaginationProps, TabsProps as AntdTabsProps, FormInstance as AntdFormInstance } from 'antd';
import { SortListProps } from '../sort/types';
import { FilterItemProps } from '../filter/types';
import { FilterListProps } from '../filter/components/FilterButton/types';
/**
 * 子组件属性集合类型定义
 */
export interface ChildComponentPropsType {
    /** Filter 组件属性 */
    filterComponent?: {
        value: {
            quickFilter?: FilterItemProps[];
            otherFilter?: FilterItemProps[];
        };
        formFiltersPrefix?: string;
        quickFilterMaxLength?: number;
    };
    /** QuickFilter 组件属性 */
    quickFilterComponent?: {
        filterList: FilterItemProps[];
        formFiltersPrefix?: string;
    };
    /** FilterButton 组件属性 */
    filterButtonComponent?: FilterListProps;
    /** tabsComponent 组件属性 */
    tabsComponent?: {
        items: AntdTabsProps['items'];
        type?: 'default' | 'button' | 'buttonGroup' | 'dropdown';
    };
    /** Sort 组件属性 */
    sortComponent?: SortListProps;
    /** Table 组件属性 */
    tableComponent?: AntdTableProps<any>;
    /** ColumnsSetting 组件属性 */
    columnsSettingComponent?: {
        value?: Record<string, any>[];
        onChange?: (val: Record<string, any>[]) => void;
    };
    /** Pagination 组件属性 */
    paginationComponent?: PaginationProps;
}
export interface DataSourceContainerProps extends DataSourceContextProps {
    pagination?: boolean | {
        pageNumber: number;
        pageSize: number;
    };
    childComponentProps?: ChildComponentPropsType;
}
/**
 * 扩展的 HandleActionContextType
 */
export interface HandleActionContextType extends Omit<DataSourceContextType, 'list'> {
    list: Result<any, any> & {
        onSearch: (newParams?: Record<string, any>) => void;
        onReset: () => void;
        onPageChange: (pageNumber: number, pageSize: number) => void;
        pagination?: {
            pageNumber: number;
            pageSize: number;
        };
    };
}
export interface RefManagerContextType {
    getRef: <T = any>(id: string) => T | undefined;
    registerRef: <T = any>(id: string, ref: T) => void;
    unregisterRef: (id: string) => void;
    getSharedState: <T = any>(key: string) => T | undefined;
    setSharedState: <T = any>(key: string, value: T) => void;
    subscribeSharedState: <T = any>(key: string, callback: (value: T) => void) => () => void;
}
export interface DataSourceContainerContextType {
    serverActions: HandleActionContextType;
    refManager: RefManagerContextType;
    form: AntdFormInstance;
}
export interface UseContainerContextReturnType {
    serverActions: HandleActionContextType;
    refManager: RefManagerContextType;
    form: AntdFormInstance;
    onValuesChange: (changedValues: Record<string, any>, allValues: Record<string, any>) => void;
    [key: string]: any;
}
