import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */
import { Box } from 'ink';
import { AuthType, isCodingPlanConfig } from '@hoptrendy/hopcode-core';
import { Header, AuthDisplayType } from './Header.js';
import { Tips } from './Tips.js';
import { useSettings } from '../contexts/SettingsContext.js';
import { useConfig } from '../contexts/ConfigContext.js';
import { useUIState } from '../contexts/UIStateContext.js';
/**
 * Determine the auth display type based on auth type and configuration.
 */
function getAuthDisplayType(authType, baseUrl, apiKeyEnvKey) {
    if (!authType) {
        return AuthDisplayType.UNKNOWN;
    }
    // Check if it's a Coding Plan config
    if (isCodingPlanConfig(baseUrl, apiKeyEnvKey)) {
        return AuthDisplayType.CODING_PLAN;
    }
    switch (authType) {
        case AuthType.HOPCODE_OAUTH:
            return AuthDisplayType.HOPCODE_OAUTH;
        default:
            return AuthDisplayType.API_KEY;
    }
}
export const AppHeader = ({ version }) => {
    const settings = useSettings();
    const config = useConfig();
    const uiState = useUIState();
    const contentGeneratorConfig = config.getContentGeneratorConfig();
    const authType = contentGeneratorConfig?.authType;
    const model = uiState.currentModel;
    const targetDir = config.getTargetDir();
    const showBanner = !config.getScreenReader();
    const showTips = !(settings.merged.ui?.hideTips || config.getScreenReader());
    const authDisplayType = getAuthDisplayType(authType, contentGeneratorConfig?.baseUrl, contentGeneratorConfig?.apiKeyEnvKey);
    return (_jsxs(Box, { flexDirection: "column", children: [showBanner && (_jsx(Header, { version: version, authDisplayType: authDisplayType, model: model, workingDirectory: targetDir })), showTips && _jsx(Tips, {})] }));
};
//# sourceMappingURL=AppHeader.js.map