"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getManagedAuthProfilePath = getManagedAuthProfilePath;
exports.isAuthProfileOnCooldown = isAuthProfileOnCooldown;
exports.isAuthProfileInvalid = isAuthProfileInvalid;
exports.getAuthProfileProvider = getAuthProfileProvider;
exports.supportsWorkerAuthProfile = supportsWorkerAuthProfile;
const definitions_1 = require("./definitions");
function getManagedAuthProfilePath(profile) {
    switch (profile.kind) {
        case "codex-home":
            return profile.codexHomePath;
        case "codex-env-var":
            return null;
        case "claude-cli":
            return profile.claudeConfigPath;
        case "claude-api-key":
        case "claude-env-var":
            return null;
    }
}
function isAuthProfileOnCooldown(state, now = new Date()) {
    if (state.status !== "cooldown" || !state.cooldownUntil) {
        return false;
    }
    return new Date(state.cooldownUntil).getTime() > now.getTime();
}
function isAuthProfileInvalid(state) {
    return state.status === "auth_invalid";
}
function getAuthProfileProvider(profile) {
    return definitions_1.AUTH_PROFILE_PROVIDER_BY_KIND[profile.kind];
}
function supportsWorkerAuthProfile(worker, profile) {
    return getAuthProfileProvider(profile) === worker;
}
