"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.resolveServiceRuntimeConfigScanPlan = resolveServiceRuntimeConfigScanPlan;
const config_decision_rules_1 = require("./config-decision-rules");
const config_plan_support_1 = require("./config-plan-support");
async function resolveServiceRuntimeConfigScanPlan(input) {
    const context = {
        repoRoot: input.repoRoot,
        config: input.config,
        ticketTracker: input.ticketTracker,
        issue: input.issue,
        enableImplicitReplan: input.enableImplicitReplan,
        comments: input.scanState.comments,
        scan: input.scanState.scan,
        commandDecision: input.scanState.commandDecision,
        stickyState: input.scanState.stickyState,
        canonicalWorkflowStateError: input.scanState.canonicalWorkflowStateError,
        currentWorkflowStateCommentId: input.scanState.currentWorkflowStateCommentId,
        scannedInputCursor: input.scanState.scannedInputCursor,
        currentNeedsHumanReason: input.scanState.currentNeedsHumanReason,
        responseLanguage: input.scanState.responseLanguage,
        workflowLabels: input.config.ticketTracker.workflowLabels,
    };
    const planSpec = await (0, config_decision_rules_1.resolveServiceRuntimePlanSpec)(context);
    return (0, config_plan_support_1.materializeServiceRuntimeConfigScanPlan)({
        planSpec,
        issueComments: context.comments,
        workflowLabels: context.workflowLabels,
    });
}
