export var ManagedAgentActionType;
(function (ManagedAgentActionType) {
    ManagedAgentActionType["FLAGGED_STALE"] = "flagged_stale";
    ManagedAgentActionType["SOFT_DELETED"] = "soft_deleted";
    ManagedAgentActionType["FLAGGED_BROKEN"] = "flagged_broken";
    ManagedAgentActionType["FLAGGED_SLOW"] = "flagged_slow";
    ManagedAgentActionType["FIXED_BROKEN"] = "fixed_broken";
    ManagedAgentActionType["CREATED_CONTENT"] = "created_content";
    ManagedAgentActionType["INSIGHT"] = "insight";
})(ManagedAgentActionType || (ManagedAgentActionType = {}));
export var ManagedAgentTargetType;
(function (ManagedAgentTargetType) {
    ManagedAgentTargetType["CHART"] = "chart";
    ManagedAgentTargetType["DASHBOARD"] = "dashboard";
    ManagedAgentTargetType["SPACE"] = "space";
    ManagedAgentTargetType["PROJECT"] = "project";
})(ManagedAgentTargetType || (ManagedAgentTargetType = {}));
export var ManagedAgentScheduleOption;
(function (ManagedAgentScheduleOption) {
    ManagedAgentScheduleOption["EVERY_6_HOURS"] = "every_6_hours";
    ManagedAgentScheduleOption["EVERY_12_HOURS"] = "every_12_hours";
    ManagedAgentScheduleOption["DAILY"] = "daily";
    ManagedAgentScheduleOption["EVERY_2_DAYS"] = "every_2_days";
    ManagedAgentScheduleOption["WEEKLY"] = "weekly";
})(ManagedAgentScheduleOption || (ManagedAgentScheduleOption = {}));
export const ManagedAgentScheduleCronByOption = {
    [ManagedAgentScheduleOption.EVERY_6_HOURS]: '0 */6 * * *',
    [ManagedAgentScheduleOption.EVERY_12_HOURS]: '0 */12 * * *',
    [ManagedAgentScheduleOption.DAILY]: '0 0 * * *',
    [ManagedAgentScheduleOption.EVERY_2_DAYS]: '0 0 */2 * *',
    [ManagedAgentScheduleOption.WEEKLY]: '0 0 * * 0',
};
const LEGACY_HOURLY_CRON = '0 * * * *';
export const getManagedAgentScheduleCron = (schedule = ManagedAgentScheduleOption.DAILY) => ManagedAgentScheduleCronByOption[schedule];
export const getManagedAgentScheduleOption = (scheduleCron) => {
    if (scheduleCron === LEGACY_HOURLY_CRON) {
        return ManagedAgentScheduleOption.EVERY_6_HOURS;
    }
    const match = Object.entries(ManagedAgentScheduleCronByOption).find(([, cron]) => cron === scheduleCron);
    return match ? match[0] : ManagedAgentScheduleOption.DAILY;
};
const REVERSIBLE_ACTION_TYPES = new Set([
    ManagedAgentActionType.SOFT_DELETED,
    ManagedAgentActionType.CREATED_CONTENT,
    ManagedAgentActionType.FIXED_BROKEN,
]);
export const getManagedAgentActionCategory = (actionType) => REVERSIBLE_ACTION_TYPES.has(actionType) ? 'undo' : 'dismiss';
export const getFixedBrokenMetadata = (metadata) => {
    const { previousVersionUuid } = metadata;
    return typeof previousVersionUuid === 'string'
        ? { previousVersionUuid }
        : null;
};
export var ManagedAgentRunStatus;
(function (ManagedAgentRunStatus) {
    ManagedAgentRunStatus["STARTED"] = "started";
    ManagedAgentRunStatus["COMPLETED"] = "completed";
    ManagedAgentRunStatus["ERROR"] = "error";
})(ManagedAgentRunStatus || (ManagedAgentRunStatus = {}));
//# sourceMappingURL=managedAgent.js.map