/**
 * @license
 * Copyright 2025 Steven Roussey <sroussey@gmail.com>
 * SPDX-License-Identifier: Apache-2.0
 */
import { IJobExecuteContext, Job } from "@workglow/job-queue";
import type { IExecuteContext, TaskConfig, TaskEntitlements } from "@workglow/task-graph";
import { CreateWorkflow, Task } from "@workglow/task-graph";
import { DataPortSchema, FromSchema } from "@workglow/util/schema";
declare const inputSchema: {
    readonly type: "object";
    readonly properties: {
        readonly url: {
            readonly type: "string";
            readonly title: "URL";
            readonly description: "The URL to fetch from";
            readonly format: "uri";
        };
        readonly method: {
            readonly enum: readonly ["GET", "POST", "PUT", "DELETE", "PATCH"];
            readonly title: "Method";
            readonly description: "The HTTP method to use";
            readonly default: "GET";
        };
        readonly headers: {
            readonly type: "object";
            readonly additionalProperties: {
                readonly type: "string";
            };
            readonly title: "Headers";
            readonly description: "The headers to send with the request";
        };
        readonly body: {
            readonly type: "string";
            readonly title: "Body";
            readonly description: "The body of the request";
        };
        readonly response_type: {
            readonly anyOf: readonly [{
                readonly type: "null";
            }, {
                readonly enum: readonly ["json", "text", "blob", "arraybuffer"];
            }];
            readonly title: "Response Type";
            readonly description: "The forced type of response to return. If null, the response type is inferred from the Content-Type header.";
            readonly default: null;
        };
        readonly timeout: {
            readonly type: "number";
            readonly title: "Timeout";
            readonly description: "Request timeout in milliseconds";
        };
        readonly credential_key: {
            readonly type: "string";
            readonly format: "credential";
            readonly title: "Credential Key";
            readonly description: "Key to look up in the credential store. The resolved value is sent as a Bearer token in the Authorization header.";
            readonly "x-ui-hidden": true;
        };
    };
    readonly required: readonly ["url"];
    readonly additionalProperties: false;
};
declare const outputSchema: {
    readonly type: "object";
    readonly properties: {
        readonly json: {
            readonly title: "JSON";
            readonly description: "The JSON response";
        };
        readonly text: {
            readonly type: "string";
            readonly title: "Text";
            readonly description: "The text response";
        };
        readonly blob: {
            readonly title: "Blob";
            readonly description: "The blob response";
        };
        readonly arraybuffer: {
            readonly title: "ArrayBuffer";
            readonly description: "The arraybuffer response";
        };
        readonly metadata: {
            readonly type: "object";
            readonly properties: {
                readonly contentType: {
                    readonly type: "string";
                };
                readonly headers: {
                    readonly type: "object";
                    readonly additionalProperties: {
                        readonly type: "string";
                    };
                };
            };
            readonly additionalProperties: false;
            readonly title: "Response Metadata";
            readonly description: "HTTP response metadata including content type and headers";
        };
    };
    readonly additionalProperties: false;
};
export type FetchUrlTaskInput = FromSchema<typeof inputSchema>;
export type FetchUrlTaskOutput = FromSchema<typeof outputSchema>;
/**
 * Extends the base Job class to provide custom execution functionality
 * through a provided function.
 */
export declare class FetchUrlJob<Input extends FetchUrlTaskInput = FetchUrlTaskInput, Output = FetchUrlTaskOutput> extends Job<Input, Output> {
    static readonly type: string;
    /**
     * Executes the job using the provided function.
     */
    execute(input: Input, context: IJobExecuteContext): Promise<Output>;
}
export type FetchUrlTaskConfig = TaskConfig & {
    queue?: boolean | string;
};
export declare class FetchUrlTask<Input extends FetchUrlTaskInput = FetchUrlTaskInput, Output extends FetchUrlTaskOutput = FetchUrlTaskOutput, Config extends FetchUrlTaskConfig = FetchUrlTaskConfig> extends Task<Input, Output, Config> {
    static type: string;
    static category: string;
    static title: string;
    static description: string;
    static hasDynamicSchemas: boolean;
    static hasDynamicEntitlements: boolean;
    static entitlements(): TaskEntitlements;
    /**
     * Dynamic entitlement check: when the configured URL targets a private or
     * loopback host the task additionally requires `network:private`, scoped
     * via the URL's origin so grants can be resource-limited (e.g. a dev-mode
     * grant for `http://localhost:*`). The graph runner evaluates this before
     * `execute()` runs, so a denied private URL never issues a network call.
     *
     * Root-task input may not yet be applied when entitlements are evaluated.
     * If the URL is not available at this point, fail closed and require the
     * private-network entitlement rather than under-declaring it.
     */
    entitlements(): TaskEntitlements;
    static configSchema(): DataPortSchema;
    static inputSchema(): {
        readonly type: "object";
        readonly properties: {
            readonly url: {
                readonly type: "string";
                readonly title: "URL";
                readonly description: "The URL to fetch from";
                readonly format: "uri";
            };
            readonly method: {
                readonly enum: readonly ["GET", "POST", "PUT", "DELETE", "PATCH"];
                readonly title: "Method";
                readonly description: "The HTTP method to use";
                readonly default: "GET";
            };
            readonly headers: {
                readonly type: "object";
                readonly additionalProperties: {
                    readonly type: "string";
                };
                readonly title: "Headers";
                readonly description: "The headers to send with the request";
            };
            readonly body: {
                readonly type: "string";
                readonly title: "Body";
                readonly description: "The body of the request";
            };
            readonly response_type: {
                readonly anyOf: readonly [{
                    readonly type: "null";
                }, {
                    readonly enum: readonly ["json", "text", "blob", "arraybuffer"];
                }];
                readonly title: "Response Type";
                readonly description: "The forced type of response to return. If null, the response type is inferred from the Content-Type header.";
                readonly default: null;
            };
            readonly timeout: {
                readonly type: "number";
                readonly title: "Timeout";
                readonly description: "Request timeout in milliseconds";
            };
            readonly credential_key: {
                readonly type: "string";
                readonly format: "credential";
                readonly title: "Credential Key";
                readonly description: "Key to look up in the credential store. The resolved value is sent as a Bearer token in the Authorization header.";
                readonly "x-ui-hidden": true;
            };
        };
        readonly required: readonly ["url"];
        readonly additionalProperties: false;
    };
    static outputSchema(): {
        readonly type: "object";
        readonly properties: {
            readonly json: {
                readonly title: "JSON";
                readonly description: "The JSON response";
            };
            readonly text: {
                readonly type: "string";
                readonly title: "Text";
                readonly description: "The text response";
            };
            readonly blob: {
                readonly title: "Blob";
                readonly description: "The blob response";
            };
            readonly arraybuffer: {
                readonly title: "ArrayBuffer";
                readonly description: "The arraybuffer response";
            };
            readonly metadata: {
                readonly type: "object";
                readonly properties: {
                    readonly contentType: {
                        readonly type: "string";
                    };
                    readonly headers: {
                        readonly type: "object";
                        readonly additionalProperties: {
                            readonly type: "string";
                        };
                    };
                };
                readonly additionalProperties: false;
                readonly title: "Response Metadata";
                readonly description: "HTTP response metadata including content type and headers";
            };
        };
        readonly additionalProperties: false;
    };
    /**
     * Override outputSchema to compute it dynamically based on the current response_type value.
     * If response_type is null, all output types are available.
     * If response_type is a specific value (e.g., "json"), only that output type is available.
     */
    outputSchema(): DataPortSchema;
    /**
     * Executes the fetch task, either directly or via a job queue depending on
     * the `queue` config/input. Credential resolution is handled by the input
     * resolver system — credential_key arrives already resolved.
     */
    execute(input: FetchUrlTaskInput, executeContext: IExecuteContext): Promise<Output>;
    private resolveOrCreateQueue;
    /**
     * Override setInput to detect when response_type changes and emit schemaChange event.
     * This ensures that consumers of the task are notified when the output schema changes.
     */
    setInput(input: Partial<Input>): void;
    private getDefaultQueueName;
}
export declare const fetchUrl: (input: FetchUrlTaskInput, config?: FetchUrlTaskConfig) => Promise<FetchUrlTaskOutput>;
declare module "@workglow/task-graph" {
    interface Workflow {
        fetch: CreateWorkflow<FetchUrlTaskInput, FetchUrlTaskOutput, FetchUrlTaskConfig>;
    }
}
export {};
//# sourceMappingURL=FetchUrlTask.d.ts.map