"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.resolveSchedulingCurrentLabelKey = resolveSchedulingCurrentLabelKey;
exports.isRecurringScheduleOnlyWorkflowState = isRecurringScheduleOnlyWorkflowState;
exports.isScheduledRunWorkflowState = isScheduledRunWorkflowState;
const recurring_1 = require("../../workflows/recurring");
const scheduled_run_1 = require("../../workflows/scheduled-run");
function resolveSchedulingCurrentLabelKey(workflowState) {
    if (isRecurringScheduleOnlyWorkflowState(workflowState)) {
        return "recurringScheduleCurrentLabel";
    }
    if (isScheduledRunWorkflowState(workflowState)) {
        return (0, scheduled_run_1.isCooldownScheduledRun)(workflowState)
            ? "cooldownCurrentLabel"
            : "scheduledRunCurrentLabel";
    }
    return null;
}
function isRecurringScheduleOnlyWorkflowState(workflowState) {
    return ((0, recurring_1.isRecurringParentWorkflowState)(workflowState) &&
        (workflowState.plan === null || workflowState.plan.steps.length === 0));
}
function isScheduledRunWorkflowState(workflowState) {
    return (0, scheduled_run_1.hasActiveScheduledRun)(workflowState);
}
