"use strict";
/**
 * OAuth Readiness Health Checks
 *
 * Check OAuth port availability for providers.
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.checkOAuthPortsForDashboard = void 0;
const oauth_port_diagnostics_1 = require("../../management/oauth-port-diagnostics");
/**
 * Check OAuth ports for dashboard (Gemini, Codex, Agy)
 */
async function checkOAuthPortsForDashboard() {
    const portDiagnostics = await (0, oauth_port_diagnostics_1.checkAuthCodePorts)();
    return portDiagnostics.map((diag) => {
        const providerName = diag.provider.charAt(0).toUpperCase() + diag.provider.slice(1);
        const portStr = diag.port ? ` (${diag.port})` : '';
        let status = 'ok';
        if (diag.status === 'occupied')
            status = 'warning';
        if (diag.status === 'not_applicable')
            status = 'info';
        return {
            id: `oauth-port-${diag.provider}`,
            name: `${providerName}${portStr}`,
            status,
            message: diag.message,
            details: diag.process ? `PID ${diag.process.pid}` : undefined,
            fix: diag.recommendation || undefined,
        };
    });
}
exports.checkOAuthPortsForDashboard = checkOAuthPortsForDashboard;
//# sourceMappingURL=oauth-checks.js.map