/**
 * This file is part of the NocoBase (R) project.
 * Copyright (c) 2020-2024 NocoBase Co., Ltd.
 * Authors: NocoBase Team.
 *
 * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
 * For more information, please refer to: https://www.nocobase.com/agreement.
 */
import React, { FC, ReactNode } from 'react';
import { UseRequestOptions, UseRequestService } from '../../api-client';
import { FilterParam } from '../../filter-provider/FilterProvider';
import { Designable } from '../../schema-component/hooks/useDesignable';
import { CollectionOptions } from '../collection';
import { CollectionRecord } from '../collection-record';
export interface AllDataBlockProps {
    collection: string | CollectionOptions;
    association: string;
    dataSource?: string;
    sourceId?: string | number;
    filterByTk: string | number;
    record: CollectionRecord;
    action?: 'list' | 'get';
    params?: {
        filterByTk?: string | number;
        filter?: FilterParam;
        [index: string]: any;
    };
    parentRecord?: CollectionRecord;
    requestService?: UseRequestService<any>;
    requestOptions?: UseRequestOptions;
    dataLoadingMode?: 'auto' | 'manual';
    /** 如果为 true，则区块会被隐藏 */
    hidden?: boolean;
    [index: string]: any;
}
type CollectionCreateProps = Pick<AllDataBlockProps, 'collection' | 'dataSource'>;
interface CollectionGetProps extends Pick<AllDataBlockProps, 'collection' | 'dataSource' | 'filterByTk' | 'params' | 'requestService' | 'requestOptions'> {
    action: 'get';
}
interface CollectionListProps extends Pick<AllDataBlockProps, 'collection' | 'dataSource' | 'params' | 'requestService' | 'requestOptions'> {
    action: 'list';
}
type CollectionRecordProps = Pick<AllDataBlockProps, 'collection' | 'dataSource' | 'record' | 'requestService' | 'requestOptions'>;
type AssociationCreateProps = Pick<AllDataBlockProps, 'association' | 'dataSource' | 'sourceId' | 'parentRecord'>;
interface AssociationGetProps extends Pick<AllDataBlockProps, 'association' | 'dataSource' | 'sourceId' | 'parentRecord' | 'filterByTk' | 'params' | 'requestService' | 'requestOptions'> {
    action: 'get';
}
interface AssociationListProps extends Pick<AllDataBlockProps, 'association' | 'dataSource' | 'sourceId' | 'parentRecord' | 'params' | 'requestService' | 'requestOptions'> {
    action: 'list';
}
type AssociationRecordProps = Pick<AllDataBlockProps, 'association' | 'dataSource' | 'record' | 'parentRecord' | 'requestService' | 'requestOptions'>;
type AllDataBlockType = {
    CollectionCreate: CollectionCreateProps;
    CollectionGet: CollectionGetProps;
    CollectionList: CollectionListProps;
    CollectionRecord: CollectionRecordProps;
    AssociationCreate: AssociationCreateProps;
    AssociationGet: AssociationGetProps;
    AssociationList: AssociationListProps;
    AssociationRecord: AssociationRecordProps;
};
export type DataBlockProviderProps = AllDataBlockType[keyof AllDataBlockType];
export type UseDataBlockProps<T extends keyof AllDataBlockType> = (props: DataBlockProviderProps & {
    [index: string]: any;
}) => Omit<AllDataBlockType[T], 'association' | 'collection' | 'dataSource' | 'action'> & {
    [index: string]: any;
};
export interface DataBlockContextValue<T extends {} = {}> {
    props: AllDataBlockProps & T;
    dn: Designable;
}
export declare const DataBlockContext: React.Context<DataBlockContextValue<any>>;
export declare const RerenderDataBlockProvider: FC;
/**
 * @internal
 */
export declare const AssociationOrCollectionProvider: (props: {
    collection: string | CollectionOptions;
    association: string;
    children: ReactNode;
    allowNull?: boolean;
}) => React.JSX.Element;
export declare const DataBlockProvider: FC<Partial<AllDataBlockProps>>;
export declare const useDataBlock: <T extends {}>() => DataBlockContextValue<T>;
export declare const useDataBlockProps: <T extends {}>() => AllDataBlockProps & T;
export declare const useRerenderDataBlock: () => {
    rerenderDataBlock: () => void;
};
export {};
