"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.resolveAiRunLimitPolicy = resolveAiRunLimitPolicy;
function resolveAiRunLimitPolicy(input) {
    if (input.consecutiveAiRuns >= input.config.aiRunLimits.maxRuns) {
        return { reached: true, reachedKind: "max_runs" };
    }
    const maxHours = resolveMaxHours(input.config.aiRunLimits);
    if (maxHours === null) {
        return { reached: false, reachedKind: null };
    }
    return input.totalAiRunHours >= maxHours
        ? { reached: true, reachedKind: "max_hours" }
        : { reached: false, reachedKind: null };
}
function resolveMaxHours(aiRunLimits) {
    return typeof aiRunLimits.maxHours === "number" ? aiRunLimits.maxHours : null;
}
