/**
 * 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 type { ComponentType, ReactNode } from 'react';
export declare const TASK_STATUS: {
    readonly ALL: "all";
    readonly PENDING: "pending";
    readonly COMPLETED: "completed";
};
export declare const TASK_STATUS_VALUES: readonly ["pending", "completed", "all"];
export type WorkflowTaskStatus = (typeof TASK_STATUS_VALUES)[number];
export declare const WORKFLOW_TASKS_PAGE_SIZE = 20;
export type WorkflowTaskRecord = Record<string, unknown>;
export type WorkflowTaskRequestParams = Record<string, unknown>;
export type WorkflowTaskStats = Record<string, number | undefined> & {
    pending?: number;
    completed?: number;
    all?: number;
};
export type WorkflowTaskCounts = Record<string, WorkflowTaskStats>;
export interface WorkflowTaskActionsProps {
    onlyIcon?: boolean;
    reload?: () => Promise<void>;
    workflowKey?: string;
    workflowPendingCount?: number;
}
export interface WorkflowTaskDetailModalProps {
    children?: ReactNode;
    mobile: boolean;
    onClose: () => void;
    record: WorkflowTaskRecord | null;
    title: ReactNode;
    type: TaskTypeOptions;
}
export interface WorkflowTaskRecordContextValue {
    record: WorkflowTaskRecord;
    openRecord?: (record: WorkflowTaskRecord) => void;
    refresh?: () => Promise<void>;
}
export declare const WorkflowTaskRecordContext: import("react").Context<WorkflowTaskRecordContextValue>;
export declare function useWorkflowTaskRecord(): WorkflowTaskRecordContextValue;
export interface WorkflowTaskResource {
    [action: string]: ((params?: WorkflowTaskRequestParams) => Promise<unknown>) | undefined;
}
export interface WorkflowTaskApiClient {
    resource: (name: string) => WorkflowTaskResource;
}
export interface WorkflowTaskRegistry {
    get: (key: string) => TaskTypeOptions | undefined;
    getKeys: () => Iterable<string>;
    getEntities?: () => Iterable<[string, TaskTypeOptions]>;
}
export interface WorkflowTaskPlugin {
    taskTypes: WorkflowTaskRegistry;
}
export interface WorkflowTaskFlowContext {
    api: WorkflowTaskApiClient;
    app?: {
        eventBus?: EventTarget;
        pm?: {
            get: (name: string) => WorkflowTaskPlugin | undefined;
        };
    };
    router?: {
        navigate: (path: string, options?: {
            replace?: boolean;
        }) => void;
    };
    t?: (key: string, options?: Record<string, unknown>) => string;
}
export interface TaskTypeOptions {
    key: string;
    title: string;
    collection: string;
    action?: string;
    useActionParams?: (status: WorkflowTaskStatus, workflowKey?: string) => WorkflowTaskRequestParams | undefined;
    Actions?: ComponentType<WorkflowTaskActionsProps>;
    DetailModal?: ComponentType<WorkflowTaskDetailModalProps>;
    Item: ComponentType;
    Detail: ComponentType;
    getPopupRecord?: (apiClient: WorkflowTaskApiClient, context: {
        params: WorkflowTaskRequestParams;
    }) => Promise<unknown>;
    alwaysShow?: boolean;
}
export interface WorkflowTaskListPayload {
    data: WorkflowTaskRecord[];
    meta: Record<string, unknown>;
}
export declare function normalizeWorkflowTaskStatus(status?: string): WorkflowTaskStatus;
export declare function normalizeWorkflowTaskRecordsResponse(response: unknown): WorkflowTaskListPayload;
export declare function normalizeWorkflowTaskRecordResponse(response: unknown): WorkflowTaskRecord | null;
export declare function normalizeWorkflowTaskCountsResponse(response: unknown): WorkflowTaskCounts;
export declare function getWorkflowTaskRegistry(ctx?: WorkflowTaskFlowContext): WorkflowTaskRegistry | undefined;
export declare function getWorkflowTaskTypeKeys(taskTypes?: WorkflowTaskRegistry): string[];
export declare function getWorkflowTaskRecordKey(record: WorkflowTaskRecord): unknown;
export declare function getAvailableWorkflowTaskTypeKeys(taskTypes: WorkflowTaskRegistry | undefined, counts: WorkflowTaskCounts): string[];
export declare function useWorkflowTaskCounts(ctx: WorkflowTaskFlowContext | undefined, taskTypes: WorkflowTaskRegistry | undefined): {
    counts: WorkflowTaskCounts;
    total: number;
    reload: () => Promise<void>;
};
