import { ContentScriptMessage } from './messages';
import { ConsentOMaticConfig } from './cmps/consentomatic';
import { AutoConsentCMPRule, ElementSelector, HideMethod, RunContext, VisibilityCheck } from './rules';
import { CompactCMPRuleset } from './encoding';
export type MessageSender = (message: ContentScriptMessage) => Promise<void>;
export interface AutoCMP {
    name: string;
    hasSelfTest: boolean;
    isIntermediate: boolean;
    isCosmetic: boolean;
    prehideSelectors?: string[];
    runContext: RunContext;
    checkRunContext(): boolean;
    checkFrameContext(isTop: boolean): boolean;
    hasMatchingUrlPattern(): boolean;
    detectCmp(): Promise<boolean>;
    detectPopup(): Promise<boolean>;
    optOut(): Promise<boolean>;
    optIn(): Promise<boolean>;
    openCmp(): Promise<boolean>;
    test(): Promise<boolean>;
}
export interface DomActionsProvider {
    click(selector: ElementSelector, all: boolean): Promise<boolean>;
    clickElement(element: HTMLElement): Promise<boolean>;
    elementExists(selector: ElementSelector): boolean;
    elementVisible(selector: ElementSelector, check: VisibilityCheck): boolean;
    waitForElement(selector: ElementSelector, timeout?: number): Promise<boolean>;
    waitForVisible(selector: ElementSelector, timeout?: number, check?: VisibilityCheck): Promise<boolean>;
    waitForThenClick(selector: ElementSelector, timeout?: number, all?: boolean): Promise<boolean>;
    wait(ms: number): Promise<true>;
    hide(selector: string, method: HideMethod): boolean;
    removeClass(selector: ElementSelector, className: string): boolean;
    setStyle(selector: ElementSelector, css: string): boolean;
    addStyle(selector: ElementSelector, css: string): boolean;
    prehide(selector: string): boolean;
    undoPrehide(): void;
    querySingleReplySelector(selector: string, parent?: any): HTMLElement[];
    querySelectorChain(selectors: string[]): HTMLElement[];
    elementSelector(selector: ElementSelector): HTMLElement[];
    waitForMutation(selector: ElementSelector): Promise<boolean>;
}
export type RuleBundle = {
    autoconsent: AutoConsentCMPRule[];
    compact?: CompactCMPRuleset;
    consentomatic?: {
        [name: string]: ConsentOMaticConfig;
    };
};
export type AutoAction = 'optOut' | 'optIn' | null;
export type Config = {
    enabled: boolean;
    autoAction: AutoAction;
    disabledCmps: string[];
    enablePrehide: boolean;
    enableCosmeticRules: boolean;
    enableGeneratedRules: boolean;
    detectRetries: number;
    isMainWorld: boolean;
    prehideTimeout: number;
    enableFilterList: boolean;
    enableHeuristicDetection: boolean;
    enableHeuristicAction: boolean;
    visualTest: boolean;
    logs: {
        lifecycle: boolean;
        rulesteps: boolean;
        detectionsteps: boolean;
        evals: boolean;
        errors: boolean;
        messages: boolean;
        waits: boolean;
    };
};
export type LifecycleState = 'loading' | 'initialized' | 'waitingForInitResponse' | 'started' | 'nothingDetected' | 'cosmeticFiltersDetected' | 'cmpDetected' | 'openPopupDetected' | 'runningOptOut' | 'runningOptIn' | 'optOutSucceeded' | 'optOutFailed' | 'optInSucceeded' | 'optInFailed' | 'done';
export type ConsentState = {
    cosmeticFiltersOn: boolean;
    filterListReported: boolean;
    lifecycle: LifecycleState;
    prehideOn: boolean;
    findCmpAttempts: number;
    detectedCmps: string[];
    detectedPopups: string[];
    heuristicPatterns: string[];
    heuristicSnippets: string[];
    selfTest: boolean | null;
    clicks: number;
    startTime: number;
    endTime: number;
};
export interface ButtonData {
    text: string;
    element: HTMLElement;
}
export interface PopupData {
    text: string;
    element: HTMLElement;
    buttons: ButtonData[];
    rejectButtons?: ButtonData[];
    otherButtons?: ButtonData[];
}
