import { Manifest } from './parser.js';

/**
 * Options for apply rulesets to manifest.
 */
type ApplyRulesetsOptions = {
    /**
     * Array of filters ids to append. If empty, all filters will be appended.
     * Appended filters will be disabled by default.
     */
    ids?: string[];
    /**
     * Array of filters ids to enable.
     * If empty, all filters will be disabled.
     */
    enable?: string[];
    /**
     * Flag determines whether to overwrite rulesets with existing id.
     *
     * @default false
     */
    forceUpdate?: boolean;
    /**
     * Prefix for ruleset file name.
     *
     * @default 'ruleset_'
     */
    rulesetPrefix?: string;
};
/**
 * Generates relative path for specified ruleset.
 *
 * @param rulesetId Ruleset id.
 */
type RulesetPathGenerator = (rulesetId: string) => string;
/**
 * Api for injecting rulesets into manifest.
 */
interface RulesetsInjectorInterface {
    /**
     * Scans filters directory and append rulesets to manifest.
     *
     * @param generateRulesetPath Function that generates relative path for ruleset.
     * @param manifest Manifest record.
     * @param filterNames Array of filter file names.
     * @param options Apply options {@link ApplyRulesetsOptions}.
     *
     * @returns Patched manifest with defined declarative_net_request.
     */
    applyRulesets<T extends Manifest>(generateRulesetPath: RulesetPathGenerator, manifest: T, filterNames: string[], options?: Partial<ApplyRulesetsOptions>): T;
}
/**
 * @see {@link RulesetsInjectorInterface}
 */
declare class RulesetsInjector implements RulesetsInjectorInterface {
    /**
     * Default prefix for ruleset id.
     */
    private static readonly DEFAULT_RULESET_PREFIX;
    /**
     * @inheritdoc
     * @throws Error if manifest already contains ruleset with the specified ids
     * and {@link options.forceUpdate} is `false` or if manifest file or filters directory are not found.
     */
    applyRulesets<T extends Manifest>(generateRulesetPath: RulesetPathGenerator, manifest: T, filterNames: string[], options?: ApplyRulesetsOptions): T;
}

export { RulesetsInjector };
export type { ApplyRulesetsOptions, RulesetPathGenerator, RulesetsInjectorInterface };
