import { Module } from "../modules/Module";
import { flowsConfigSchema } from "./flows-schema";
import { type s } from "bknd/utils";
export type AppFlowsSchema = s.Static<typeof flowsConfigSchema>;
export type TAppFlowSchema = AppFlowsSchema["flows"][number];
export type TAppFlowTriggerSchema = TAppFlowSchema["trigger"];
export type { TAppFlowTaskSchema } from "./flows-schema";
export declare class AppFlows extends Module<AppFlowsSchema> {
    private flows;
    getSchema(): s.ObjectSchema<{
        readonly basepath: s.StringSchema<{
            readonly default: "/api/flows";
        }> & {
            readonly default: "/api/flows";
        };
        readonly flows: s.RecordSchema<s.ObjectSchema<{
            readonly trigger: s.Schema<s.IUnionOptions, {
                config?: {
                    mode: "sync" | "async";
                } | {
                    event: string;
                    mode: "sync" | "async";
                } | {
                    path: string;
                    mode: "sync" | "async";
                    method: "GET" | "POST" | "PATCH" | "PUT" | "DELETE";
                    response_type: "html" | "json" | "text";
                } | undefined;
                type: "manual" | "event" | "http";
            }, never> & s.Merge<s.IUnionOptions & {
                anyOf: s.ObjectSchema<{
                    readonly type: s.Schema<s.ILiteralOptions, "manual" | "event" | "http", "manual" | "event" | "http"> & s.Merge<s.ILiteralOptions & {
                        const: "manual" | "event" | "http";
                    }>;
                    readonly config: ({
                        properties: {
                            readonly mode: s.StringSchema<{
                                readonly enum: readonly ["sync", "async"];
                                readonly default: "async";
                            }> & {
                                readonly enum: readonly ["sync", "async"];
                                readonly default: "async";
                            };
                        };
                        required: string[] | undefined;
                        strict: () => s.ObjectSchema<{
                            readonly mode: s.StringSchema<{
                                readonly enum: readonly ["sync", "async"];
                                readonly default: "async";
                            }> & {
                                readonly enum: readonly ["sync", "async"];
                                readonly default: "async";
                            };
                        }, s.Merge<s.Merge<s.IObjectOptions & {
                            additionalProperties: false;
                        }> & {
                            additionalProperties: false;
                        }>>;
                        partial: () => s.ObjectSchema<{
                            readonly mode: s.Schema<s.ISchemaOptions, "sync" | "async" | undefined, "sync" | "async" | undefined>;
                        }, s.Merge<s.IObjectOptions & {
                            additionalProperties: false;
                        }>>;
                    } & s.Schema<s.ISchemaOptions, {
                        mode: "sync" | "async";
                    } | undefined, {
                        mode: "sync" | "async";
                    } | undefined>) | ({
                        properties: {
                            readonly mode: s.StringSchema<{
                                readonly enum: readonly ["sync", "async"];
                                readonly default: "async";
                            }> & {
                                readonly enum: readonly ["sync", "async"];
                                readonly default: "async";
                            };
                            readonly event: s.StringSchema<s.IStringOptions> & s.IStringOptions;
                        };
                        required: string[] | undefined;
                        strict: () => s.ObjectSchema<{
                            readonly mode: s.StringSchema<{
                                readonly enum: readonly ["sync", "async"];
                                readonly default: "async";
                            }> & {
                                readonly enum: readonly ["sync", "async"];
                                readonly default: "async";
                            };
                            readonly event: s.StringSchema<s.IStringOptions> & s.IStringOptions;
                        }, s.Merge<s.Merge<s.IObjectOptions & {
                            additionalProperties: false;
                        }> & {
                            additionalProperties: false;
                        }>>;
                        partial: () => s.ObjectSchema<{
                            readonly mode: s.Schema<s.ISchemaOptions, "sync" | "async" | undefined, "sync" | "async" | undefined>;
                            readonly event: s.Schema<s.ISchemaOptions, string | undefined, string | undefined>;
                        }, s.Merge<s.IObjectOptions & {
                            additionalProperties: false;
                        }>>;
                    } & s.Schema<s.ISchemaOptions, {
                        event: string;
                        mode: "sync" | "async";
                    } | undefined, {
                        event: string;
                        mode: "sync" | "async";
                    } | undefined>) | ({
                        properties: {
                            readonly mode: s.StringSchema<{
                                readonly enum: readonly ["sync", "async"];
                                readonly default: "async";
                            }> & {
                                readonly enum: readonly ["sync", "async"];
                                readonly default: "async";
                            };
                            readonly path: s.StringSchema<{
                                readonly pattern: "^/.*$";
                            }> & {
                                readonly pattern: "^/.*$";
                            };
                            readonly method: s.StringSchema<{
                                readonly enum: readonly ["GET", "POST", "PUT", "PATCH", "DELETE"];
                                readonly default: "GET";
                            }> & {
                                readonly enum: readonly ["GET", "POST", "PUT", "PATCH", "DELETE"];
                                readonly default: "GET";
                            };
                            readonly response_type: s.StringSchema<{
                                readonly enum: readonly ["json", "text", "html"];
                                readonly default: "json";
                            }> & {
                                readonly enum: readonly ["json", "text", "html"];
                                readonly default: "json";
                            };
                        };
                        required: string[] | undefined;
                        strict: () => s.ObjectSchema<{
                            readonly mode: s.StringSchema<{
                                readonly enum: readonly ["sync", "async"];
                                readonly default: "async";
                            }> & {
                                readonly enum: readonly ["sync", "async"];
                                readonly default: "async";
                            };
                            readonly path: s.StringSchema<{
                                readonly pattern: "^/.*$";
                            }> & {
                                readonly pattern: "^/.*$";
                            };
                            readonly method: s.StringSchema<{
                                readonly enum: readonly ["GET", "POST", "PUT", "PATCH", "DELETE"];
                                readonly default: "GET";
                            }> & {
                                readonly enum: readonly ["GET", "POST", "PUT", "PATCH", "DELETE"];
                                readonly default: "GET";
                            };
                            readonly response_type: s.StringSchema<{
                                readonly enum: readonly ["json", "text", "html"];
                                readonly default: "json";
                            }> & {
                                readonly enum: readonly ["json", "text", "html"];
                                readonly default: "json";
                            };
                        }, s.Merge<s.Merge<s.IObjectOptions & {
                            additionalProperties: false;
                        }> & {
                            additionalProperties: false;
                        }>>;
                        partial: () => s.ObjectSchema<{
                            readonly mode: s.Schema<s.ISchemaOptions, "sync" | "async" | undefined, "sync" | "async" | undefined>;
                            readonly path: s.Schema<s.ISchemaOptions, string | undefined, string | undefined>;
                            readonly method: s.Schema<s.ISchemaOptions, "GET" | "POST" | "PATCH" | "PUT" | "DELETE" | undefined, "GET" | "POST" | "PATCH" | "PUT" | "DELETE" | undefined>;
                            readonly response_type: s.Schema<s.ISchemaOptions, "html" | "json" | "text" | undefined, "html" | "json" | "text" | undefined>;
                        }, s.Merge<s.IObjectOptions & {
                            additionalProperties: false;
                        }>>;
                    } & s.Schema<s.ISchemaOptions, {
                        path: string;
                        mode: "sync" | "async";
                        method: "GET" | "POST" | "PATCH" | "PUT" | "DELETE";
                        response_type: "html" | "json" | "text";
                    } | undefined, {
                        path: string;
                        mode: "sync" | "async";
                        method: "GET" | "POST" | "PATCH" | "PUT" | "DELETE";
                        response_type: "html" | "json" | "text";
                    } | undefined>);
                }, s.Merge<{
                    readonly title: string;
                } & {
                    additionalProperties: false;
                }>>[];
            }>;
            readonly tasks: {
                additionalProperties: s.Schema<s.IUnionOptions, {
                    type: "log" | "fetch" | "render" | "subflow";
                    params: {
                        method?: string | undefined;
                        headers?: {
                            key: string;
                            value: string;
                        }[] | undefined;
                        body?: string | undefined;
                        normal?: number | undefined;
                        url: string;
                    } | {
                        delay: number;
                    } | {
                        render: string;
                    } | {
                        flow?: any;
                        input?: any;
                        loop?: boolean | undefined;
                    };
                }, never> & s.Merge<s.IUnionOptions & {
                    anyOf: s.ObjectSchema<{
                        readonly type: s.Schema<s.ILiteralOptions, "log" | "fetch" | "render" | "subflow", "log" | "fetch" | "render" | "subflow"> & s.Merge<s.ILiteralOptions & {
                            const: "log" | "fetch" | "render" | "subflow";
                        }>;
                        readonly params: s.ObjectSchema<{
                            readonly url: s.StringSchema<{
                                readonly pattern: "^(http|https)://";
                            }> & {
                                readonly pattern: "^(http|https)://";
                            };
                            readonly method: {
                                readonly default: "GET";
                                readonly enum: string[];
                            } & s.Schema<s.ISchemaOptions, string | undefined, string | undefined>;
                            readonly headers: {
                                default?: any;
                                enum?: (readonly any[] | any[]) | undefined;
                                const?: any;
                                $defs?: Record<string, s.Schema> | undefined;
                                contains?: s.Schema | undefined;
                                minContains?: number | undefined;
                                maxContains?: number | undefined;
                                prefixItems?: s.Schema[] | undefined;
                                uniqueItems?: boolean | undefined;
                                maxItems?: number | undefined;
                                minItems?: number | undefined;
                                readonly items?: s.ObjectSchema<{
                                    readonly key: s.StringSchema<s.IStringOptions> & s.IStringOptions;
                                    readonly value: s.StringSchema<s.IStringOptions> & s.IStringOptions;
                                }, s.Merge<s.IObjectOptions & {
                                    additionalProperties: false;
                                }>> | undefined;
                            } & s.Schema<s.ISchemaOptions, {
                                key: string;
                                value: string;
                            }[] | undefined, {
                                key: string;
                                value: string;
                            }[] | undefined>;
                            readonly body: {
                                default?: any;
                                maxLength?: number | undefined;
                                minLength?: number | undefined;
                                pattern?: (string | RegExp) | undefined;
                                format?: string | undefined;
                                enum?: (readonly any[] | any[]) | undefined;
                                const?: any;
                            } & s.Schema<s.ISchemaOptions, string | undefined, string | undefined>;
                            readonly normal: {
                                default?: any;
                                enum?: (readonly any[] | any[]) | undefined;
                                const?: any;
                                multipleOf?: number | undefined;
                                maximum?: number | undefined;
                                exclusiveMaximum?: number | undefined;
                                minimum?: number | undefined;
                                exclusiveMinimum?: number | undefined;
                            } & s.Schema<s.ISchemaOptions, number | undefined, number | undefined>;
                        }, s.Merge<s.IObjectOptions & {
                            additionalProperties: false;
                        }>> | s.ObjectSchema<{
                            readonly delay: s.Schema<{
                                readonly default: 10;
                            }, number, number> & {
                                readonly default: 10;
                            };
                        }, s.Merge<s.IObjectOptions & {
                            additionalProperties: false;
                        }>> | s.ObjectSchema<{
                            readonly render: s.StringSchema<s.IStringOptions> & s.IStringOptions;
                        }, s.Merge<s.IObjectOptions & {
                            additionalProperties: false;
                        }>> | s.ObjectSchema<{
                            readonly flow: s.Schema<s.IAnyOptions, any, any> & s.IAnyOptions;
                            readonly input: {
                                [x: string]: any;
                                [x: number]: any;
                            } & s.Schema<s.ISchemaOptions, any, any>;
                            readonly loop: {
                                default?: any;
                                enum?: (readonly any[] | any[]) | undefined;
                                const?: any;
                            } & s.Schema<s.ISchemaOptions, boolean | undefined, boolean | undefined>;
                        }, s.Merge<s.IObjectOptions & {
                            additionalProperties: false;
                        }>>;
                    }, s.Merge<{
                        readonly title: string;
                    } & {
                        additionalProperties: false;
                    }>>[];
                }>;
            } & s.Schema<s.ISchemaOptions, {
                [x: string]: {
                    type: "log" | "fetch" | "render" | "subflow";
                    params: {
                        method?: string | undefined;
                        headers?: {
                            key: string;
                            value: string;
                        }[] | undefined;
                        body?: string | undefined;
                        normal?: number | undefined;
                        url: string;
                    } | {
                        delay: number;
                    } | {
                        render: string;
                    } | {
                        flow?: any;
                        input?: any;
                        loop?: boolean | undefined;
                    };
                };
            } | undefined, {
                [x: string]: never;
            } | undefined>;
            readonly connections: {
                additionalProperties: s.ObjectSchema<{
                    readonly source: s.StringSchema<s.IStringOptions> & s.IStringOptions;
                    readonly target: s.StringSchema<s.IStringOptions> & s.IStringOptions;
                    readonly config: s.ObjectSchema<{
                        readonly condition: s.Schema<s.ISchemaOptions, {
                            type: "success";
                        } | {
                            type: "error";
                        } | {
                            value: string;
                            type: "matches";
                            path: string;
                        } | undefined, {
                            type: "error";
                        } | {
                            value: string;
                            type: "matches";
                            path: string;
                        } | {
                            type: "success";
                        } | undefined>;
                        readonly max_retries: s.Schema<s.ISchemaOptions, number | undefined, number | undefined>;
                    }, s.Merge<s.IObjectOptions & {
                        additionalProperties: false;
                    }>>;
                }, s.Merge<s.IObjectOptions & {
                    additionalProperties: false;
                }>>;
            } & s.Schema<s.ISchemaOptions, {
                [x: string]: {
                    config: {
                        condition?: {
                            type: "success";
                        } | {
                            type: "error";
                        } | {
                            value: string;
                            type: "matches";
                            path: string;
                        } | undefined;
                        max_retries?: number | undefined;
                    };
                    target: string;
                    source: string;
                };
            } | undefined, {
                [x: string]: {
                    config: {
                        condition?: {
                            type: "error";
                        } | {
                            value: string;
                            type: "matches";
                            path: string;
                        } | {
                            type: "success";
                        } | undefined;
                        max_retries?: number | undefined;
                    };
                    target: string;
                    source: string;
                };
            } | undefined>;
            readonly start_task: {
                default?: any;
                maxLength?: number | undefined;
                minLength?: number | undefined;
                pattern?: (string | RegExp) | undefined;
                format?: string | undefined;
                enum?: (readonly any[] | any[]) | undefined;
                const?: any;
            } & s.Schema<s.ISchemaOptions, string | undefined, string | undefined>;
            readonly responding_task: {
                default?: any;
                maxLength?: number | undefined;
                minLength?: number | undefined;
                pattern?: (string | RegExp) | undefined;
                format?: string | undefined;
                enum?: (readonly any[] | any[]) | undefined;
                const?: any;
            } & s.Schema<s.ISchemaOptions, string | undefined, string | undefined>;
        }, s.Merge<s.IObjectOptions & {
            additionalProperties: false;
        }>>, {
            readonly default: {};
        }>;
    }, s.Merge<s.IObjectOptions & {
        additionalProperties: false;
    }>>;
    private getFlowInfo;
    build(): Promise<void>;
    toJSON(): {
        flows: {
            [x: string]: {
                trigger: {
                    type: string;
                    config: {
                        mode: "sync" | "async";
                    };
                };
                tasks: {
                    [k: string]: {
                        type: string;
                        params: unknown;
                    };
                };
                connections: {
                    [k: string]: {
                        source: string;
                        target: string;
                        config: {
                            condition: {
                                type: "error" | "success" | "matches";
                                path: string | undefined;
                                value: any;
                            } | undefined;
                            max_retries?: number;
                        };
                    };
                };
                start_task: string;
                responding_task: string | undefined;
            };
        };
        basepath: string;
    };
}
