import { Feature } from '@letsrunit/gherkin';
import { Journal } from '@letsrunit/journal';
import * as z from 'zod';
import { PageInfo } from '@letsrunit/playwright';
import { RequiredAndOptional } from '@letsrunit/utils';

declare function refineSuggestion(suggestion: string | Pick<Feature, 'name' | 'description' | 'comments'>): Promise<Required<Pick<Feature, 'name' | 'description' | 'comments'>>>;

interface ExplainOptions {
    dbPath?: string;
    artifactsDir?: string;
}
interface ExplainScenario {
    scenarioId: string;
    scenarioName: string;
    featurePath: string;
    steps: string;
    failureMessage: string;
    update: 'test' | 'code';
    updateMessage: string;
    reason: string;
    advice: string;
}
interface ExplainScenarioError {
    scenarioId: string;
    scenarioName: string;
    featurePath: string;
    error: string;
}
interface ExplainResult {
    hasRun: boolean;
    totalFailed: number;
    explanations: ExplainScenario[];
    errors: ExplainScenarioError[];
}
declare function explain(options?: ExplainOptions): Promise<ExplainResult>;

declare const ActionSchema: z.ZodObject<{
    name: z.ZodString;
    description: z.ZodString;
    done: z.ZodString;
}, z.core.$strip>;
type Action = z.infer<typeof ActionSchema>;
declare const AssessmentSchema: z.ZodObject<{
    purpose: z.ZodString;
    websiteName: z.ZodOptional<z.ZodString>;
    loginAvailable: z.ZodBoolean;
    actions: z.ZodArray<z.ZodObject<{
        name: z.ZodString;
        description: z.ZodString;
        done: z.ZodString;
    }, z.core.$strip>>;
}, z.core.$strip>;
type Assessment = z.infer<typeof AssessmentSchema>;

interface AppInfo extends PageInfo {
    /** Application name */
    name?: string;
    /** Application purpose */
    purpose: string;
    /** Detected login or registration */
    loginAvailable: boolean;
}

interface Result {
    status: 'passed' | 'failed' | 'error';
    feature?: Feature;
}

interface ExploreOptions {
    headless?: boolean;
    journal?: Journal;
}
type PreparedAction = Action & {
    path?: string;
    run: () => Promise<Result>;
};
declare function explore(target: string, opts: ExploreOptions | undefined, process: (info: AppInfo, actions: PreparedAction[]) => Promise<any>): Promise<Result>;

interface GenerateOptions$1 {
    headless?: boolean;
    journal?: Journal;
    accounts?: Record<string, string>;
    timeout?: number;
}
type GenerateInput = RequiredAndOptional<Feature, 'name' | 'description', 'comments'>;
declare function generate(target: string, suggestion: GenerateInput, opts?: GenerateOptions$1): Promise<Result>;

interface GenerateOptions {
    headless?: boolean;
    journal?: Journal;
}
declare function run(target: string, feature: Feature | string, opts?: GenerateOptions): Promise<Result>;

export { type PreparedAction as Action, ActionSchema, type AppInfo, type Assessment, AssessmentSchema, type ExplainResult, type Result, explain, explore, generate, refineSuggestion, run };
