import { type OpenAPIV3 } from 'openapi-types';
import type CreativeEditorSDK from '@cesdk/cesdk-js';
import type { CreativeEngine } from '@cesdk/cesdk-js';
import { ImageOutput, RenderCustomProperty, GetBlockInput, Provider, Middleware } from '@imgly/plugin-ai-generation-web';
import { DimensionConstraints } from './utils';
import { ImageQuickActionSupportMap } from '../types';
/**
 * Configuration for Runware image providers.
 */
type ImageProviderConfiguration = {
    /**
     * HTTP endpoint URL for the Runware proxy. The proxy handles API key injection.
     */
    proxyUrl: string;
    /**
     * Enable debug logging for provider creation and API calls.
     */
    debug?: boolean;
    /**
     * Middleware functions to process inputs/outputs.
     */
    middlewares?: Middleware<any, any>[];
    /**
     * @deprecated Use `middlewares` instead.
     */
    middleware?: Middleware<any, any>[];
    /**
     * Override provider's default history asset source.
     */
    history?: false | '@imgly/local' | '@imgly/indexedDB' | (string & {});
    /**
     * Configure supported quick actions.
     */
    supportedQuickActions?: {
        [quickActionId: string]: Partial<ImageQuickActionSupportMap<any>[string]> | false | null;
    };
};
/**
 * Options for creating a Runware image provider.
 */
interface CreateProviderOptions<I extends Record<string, any>> {
    /**
     * Runware model identifier (AIR format, e.g., 'bfl:5@1').
     */
    modelId: string;
    /**
     * Unique provider identifier for registration.
     */
    providerId: string;
    /**
     * Human-readable provider name displayed in the UI.
     */
    name: string;
    /**
     * OpenAPI schema document describing the input parameters.
     */
    schema: OpenAPIV3.Document;
    /**
     * JSON reference to the input schema (e.g., '#/components/schemas/Input').
     */
    inputReference: string;
    /**
     * User flow mode for the provider panel.
     */
    useFlow?: 'placeholder' | 'generation-only';
    /**
     * Initialization callback when the provider is registered.
     */
    initialize?: (context: {
        cesdk?: CreativeEditorSDK;
        engine: CreativeEngine;
    }) => void;
    /**
     * Custom property renderers for the input panel.
     */
    renderCustomProperty?: RenderCustomProperty;
    /**
     * Quick actions this provider supports.
     */
    supportedQuickActions?: ImageQuickActionSupportMap<I>;
    /**
     * Get block dimensions from input parameters.
     */
    getBlockInput?: GetBlockInput<'image', I>;
    /**
     * Extract image dimensions from input parameters.
     */
    getImageSize?: (input: I) => {
        width: number;
        height: number;
    };
    /**
     * Transform input parameters to Runware API format.
     */
    mapInput: (input: I) => Record<string, any>;
    /**
     * Provider-specific middleware functions.
     */
    middleware?: Middleware<I, ImageOutput>[];
    /**
     * Custom headers to include in API requests.
     */
    headers?: Record<string, string>;
    /**
     * CE.SDK instance for image URL conversion.
     */
    cesdk?: CreativeEditorSDK;
    /**
     * Model-specific dimension constraints for image-to-image.
     * Required for I2I providers to properly constrain output dimensions.
     */
    dimensionConstraints?: DimensionConstraints;
    /**
     * Skip automatic dimension injection for image-to-image.
     * When true, the API will auto-detect dimensions from the reference image.
     */
    skipAutoDimensions?: boolean;
}
/**
 * Creates a Runware image provider from schema. This should work out of the box
 * but may be rough around the edges and should/can be further customized.
 */
declare function createImageProvider<I extends Record<string, any> & {
    image_url?: string;
    image_urls?: string[];
}>(options: CreateProviderOptions<I>, config: ImageProviderConfiguration): Provider<'image', I, ImageOutput>;
export default createImageProvider;
export type { ImageProviderConfiguration as RunwareProviderConfiguration };
