"use strict";
/**
 * Pipeline Configuration — Scan options and mode resolution.
 *
 * Handles both scan mode (full/incremental) and depth (local/verified/deep).
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.resolveScanModeConfig = resolveScanModeConfig;
const types_1 = require("../shared/types");
/**
 * Resolve scan mode configuration from options
 *
 * Handles both scan mode (full/incremental) and depth (local/verified/deep).
 * Depth controls AI usage:
 * - local: skip AI validation + skip Layer 3
 * - verified: run AI validation, skip Layer 3
 * - deep: run AI validation + Layer 3
 */
function resolveScanModeConfig(options) {
    const scanModeOption = options.scanMode;
    // Determine base mode
    const mode = !scanModeOption ? 'full'
        : typeof scanModeOption === 'string' ? scanModeOption
            : scanModeOption.mode;
    const defaults = types_1.SCAN_MODE_DEFAULTS[mode];
    // Build config from defaults + explicit overrides
    let config = {
        ...defaults,
        mode,
        ...(typeof scanModeOption === 'object' ? scanModeOption : {}),
    };
    // Apply depth mode (default: 'local')
    const depth = options.scanDepth ?? 'local';
    config.scanDepth = depth;
    // Map depth to skipAIValidation/skipLayer3 unless explicitly overridden
    const hasExplicitSkipAI = typeof scanModeOption === 'object' && scanModeOption.skipAIValidation !== undefined;
    const hasExplicitSkipL3 = typeof scanModeOption === 'object' && scanModeOption.skipLayer3 !== undefined;
    if (!hasExplicitSkipAI) {
        config.skipAIValidation = depth === 'local';
    }
    if (!hasExplicitSkipL3) {
        config.skipLayer3 = depth !== 'deep';
    }
    return config;
}
//# sourceMappingURL=config.js.map