import type { Context } from '../../context.js';
import type { _ConfigApplicationContext } from '../../../stdlib/index.js';
/** @public */
export declare namespace CustomAction {
    /**
     * Response payload for GetFormState.
     * @public
     */
    interface GetFormStateResponse {
        /** Updated form field values. Use this to set defaults, clear dependent fields when a parent changes, or preserve matching values across schema changes. Only fields included here are updated. Omitted fields keep their current values. */
        values: Record<string, unknown>;
        /** Per-field configuration keyed by field name. */
        config: Record<string, FormStateFieldConfig>;
    }
    /**
     * Configuration for a single form field, returned by GetFormState.
     * @public
     */
    interface FormStateFieldConfig {
        /** Dropdown options for `dynamic_select` fields. */
        options: SelectOption[];
        /** JSON Schema for dynamic_schema fields. Defines the structure of a dynamic object field (for example, template merge variables). V0 limitation: must be a flat object with string properties only. */
        schema: Record<string, unknown>;
        /** Whether the field is disabled (non-interactive). */
        disabled?: boolean;
        /** Whether the field is hidden from the form. */
        hidden?: boolean;
        /** Warning message displayed on the field. You can still save the workflow. */
        warning?: string;
        /** Error message displayed on the field. Blocks saving the workflow. */
        error?: string;
    }
    /**
     * An option in a dynamic_select dropdown.
     * @public
     */
    interface SelectOption {
        value: string;
        label: string;
    }
    /**
     * Request payload for GetFormState, sent at configuration time.
     * @public
     */
    interface GetFormStateRequest {
        /** Current form field values. Contains all field values in the form, including fields the user has not yet interacted with (which might be null). */
        values: Record<string, unknown>;
        /** The name of the field that just changed, triggering this request. Empty on initial form load; set to the field name (for example, `audience_id`) when a user changes a value. */
        changedField?: string;
    }
    /** @public */
    type ExecuteCustomActionResponse = Record<string, never>;
    /**
     * Request payload for executing a custom action, provided at workflow runtime.
     * @public
     */
    interface ExecuteCustomActionRequest {
        /** Custom input data for the action, validated against the app's input_schema. Contains the field values configured by the user in the workflow builder. */
        customInput: Record<string, unknown>;
    }
    /**
     * @public
     * @deprecated Platform dispatch handles wire/SDK conversion.
     */
    function prepareArgsExecute(proto: unknown): ExecuteCustomActionRequest;
    /**
     * @public
     * @deprecated Platform dispatch handles wire/SDK conversion.
     */
    function prepareResultExecute(result: ExecuteCustomActionResponse): ExecuteCustomActionResponse;
    /** @internal */
    function $platformWrapExecute(configTransformer?: (wireConfig: unknown, appCtx: _ConfigApplicationContext) => unknown): (cls: new () => { execute(...a: unknown[]): unknown }, wireArgs: unknown, wireConfig: unknown, ctx: unknown) => unknown;
    /**
     * @public
     * @deprecated Platform dispatch handles wire/SDK conversion.
     */
    function prepareArgsGetFormState(proto: unknown): GetFormStateRequest;
    /**
     * @public
     * @deprecated Platform dispatch handles wire/SDK conversion.
     */
    function prepareResultGetFormState(result: GetFormStateResponse): GetFormStateResponse;
    /** @internal */
    function $platformWrapGetFormState(configTransformer?: (wireConfig: unknown, appCtx: _ConfigApplicationContext) => unknown): (cls: new () => { getFormState(...a: unknown[]): unknown }, wireArgs: unknown, wireConfig: unknown, ctx: unknown) => unknown;
    /**
     * Executes the custom action at workflow runtime. Called when a workflow triggers this action, with the configured input values.
     * @public
     */
    type ExecuteFunction<Config> = (request: ExecuteCustomActionRequest, config: Config, context: Context) => ExecuteCustomActionResponse | PromiseLike<ExecuteCustomActionResponse>;
    /**
     * Returns the current form state for the action's configuration UI. Called at configuration time (not runtime) to power dynamic form behavior, including dropdown options, dynamic JSON schemas, field visibility, and validation.
     * @public
     */
    type GetFormStateFunction<Config> = (request: GetFormStateRequest, config: Config, context: Context) => GetFormStateResponse | PromiseLike<GetFormStateResponse>;
}
/**
 * @example
 * ```ts
 * import type { Extend, Context } from '@stripe/extensibility-sdk';
 *
 * // eslint-disable-next-line @typescript-eslint/no-empty-object-type
 * interface MyCustomActionConfig {}
 *
 * export default class MyCustomAction implements Extend.Workflows
 *   .CustomAction<MyCustomActionConfig> {
 *   execute(
 *     _request: Extend.Workflows.CustomAction.ExecuteCustomActionRequest,
 *     _config: MyCustomActionConfig,
 *     _context: Context
 *   ) {
 *     // TODO: implement your action logic here
 *
 *     return {};
 *   }
 *
 *   getFormState(
 *     _request: Extend.Workflows.CustomAction.GetFormStateRequest,
 *     _config: MyCustomActionConfig,
 *     _context: Context
 *   ) {
 *     // TODO: implement your logic here
 *
 *     return {
 *       values: {},
 *       config: {},
 *     };
 *   }
 * }
 *
 * ```
 * @public
 */
export interface CustomAction<Config> {
    execute: CustomAction.ExecuteFunction<Config>;
    getFormState?: CustomAction.GetFormStateFunction<Config>;
}
//# sourceMappingURL=custom_action.d.ts.map