"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.maybeWarnAboutResumeLaneMismatch = void 0;
const path = __importStar(require("path"));
const ui_1 = require("../utils/ui");
const resume_lane_diagnostics_1 = require("./resume-lane-diagnostics");
async function maybeWarnAboutResumeLaneMismatch(profileName, accountConfigDir, args, deps = {}) {
    const resumeIntent = (0, resume_lane_diagnostics_1.parseResumeFlagIntent)(args);
    if (!resumeIntent) {
        return;
    }
    const log = deps.log ?? console.error;
    try {
        const plainLane = await (deps.resolvePlainLane ?? resume_lane_diagnostics_1.resolveRuntimePlainCcsResumeLane)();
        if (path.resolve(plainLane.configDir) === path.resolve(accountConfigDir)) {
            return;
        }
        log((0, ui_1.warn)(`Resume for account "${profileName}" will search that account lane, not the current plain ccs lane.`));
        log((0, ui_1.info)(`  Account lane: ${accountConfigDir}`));
        log((0, ui_1.info)(`  Plain ccs lane: ${plainLane.label} (${plainLane.configDir})`));
        if (resumeIntent.explicitSessionId) {
            log((0, ui_1.info)('  This explicit session ID may have been created in a different lane, so Claude may not find it here.'));
        }
        log((0, ui_1.info)('  Recover the original lane first: ccs -r'));
        log((0, ui_1.info)('  Back it up before changing setup: ccs auth backup default'));
        log((0, ui_1.info)(`  For future work, align plain ccs with this account: ccs auth default ${profileName}`));
        log('');
    }
    catch (error) {
        log((0, ui_1.warn)('Resume lane guidance skipped because diagnostics failed; continuing with the account lane.'));
        if (deps.debug ?? Boolean(process.env.CCS_DEBUG)) {
            log((0, ui_1.info)(`  Diagnostic error: ${error.message}`));
        }
    }
}
exports.maybeWarnAboutResumeLaneMismatch = maybeWarnAboutResumeLaneMismatch;
//# sourceMappingURL=resume-lane-warning.js.map