import type { ApplyResourceResult } from "./useApplyResource";
/** Detected format of the imported file content. */
export type ImportFormat = "yaml" | "json";
/**
 * Validated preview of an imported resource, shown to the user before
 * they confirm the apply operation.
 */
export interface ImportPreview {
    /** The detected resource kind. */
    readonly kind: "Agent" | "McpServer";
    /** The resource name from `metadata.name`. */
    readonly name: string;
    /** The resource slug from `metadata.slug`, if present. */
    readonly slug?: string;
    /** The detected file format. */
    readonly format: ImportFormat;
    /** The raw file content (for potential display or debugging). */
    readonly rawContent: string;
}
/** Return value of {@link useImportResource}. */
export interface UseImportResourceReturn {
    /**
     * Read and validate a file selected by the user. On success, populates
     * `preview`. On failure, populates `error`. In both cases, clears the
     * previous state first.
     */
    readonly readFile: (file: File) => Promise<void>;
    /** The validation preview, or `null` when no file has been validated. */
    readonly preview: ImportPreview | null;
    /** Validation or apply error message, or `null` when healthy. */
    readonly error: string | null;
    /** Clear all state (preview, error, internal content). */
    readonly reset: () => void;
    /**
     * Apply the previewed resource to the given organization.
     * Only callable when `preview` is non-null.
     *
     * @throws Re-throws the original error after setting `error` state.
     */
    readonly apply: (org: string) => Promise<ApplyResourceResult>;
    /** `true` while the apply RPC is in-flight. */
    readonly isApplying: boolean;
}
/**
 * Headless import hook for Stigmer resources.
 *
 * Orchestrates the file import workflow:
 * 1. User selects a `.yaml`, `.yml`, or `.json` file
 * 2. `readFile` reads the content, detects the format, and validates
 *    the structure via `parseResourceYaml`
 * 3. On success, `preview` is populated with kind, name, slug, format
 * 4. On validation error, `error` is populated with a user-facing message
 * 5. User confirms → `apply(org)` calls the appropriate SDK `apply()` method
 *
 * Follows the established mutation-hook pattern: `isApplying` + `error` +
 * `reset`. The `preview` state enables a confirmation step before committing
 * (Nielsen heuristic #3: user control, #5: error prevention).
 *
 * @example
 * ```tsx
 * const { readFile, preview, error, reset, apply, isApplying } = useImportResource();
 *
 * const handleFileChange = (e: React.ChangeEvent<HTMLInputElement>) => {
 *   const file = e.target.files?.[0];
 *   if (file) readFile(file);
 * };
 *
 * if (preview) {
 *   return (
 *     <div>
 *       <p>Import {preview.kind}: {preview.name}</p>
 *       <button onClick={() => apply(org)} disabled={isApplying}>
 *         Confirm
 *       </button>
 *     </div>
 *   );
 * }
 * ```
 *
 * @see {@link parseResourceYaml} for the validation logic
 * @see {@link ImportResourceDialog} for the styled component that composes this hook
 */
export declare function useImportResource(): UseImportResourceReturn;
//# sourceMappingURL=useImportResource.d.ts.map