/**
 * @license
 * Copyright 2026 HopCode Team
 * SPDX-License-Identifier: Apache-2.0
 */
import { AuthType } from '@hoptrendy/hopcode-core';
export function buildAuthMethods() {
    return [
        {
            id: AuthType.USE_OPENAI,
            name: 'Use OpenAI API key',
            description: 'Requires setting the `OPENAI_API_KEY` environment variable',
            _meta: {
                type: 'terminal',
                args: ['--auth-type=openai'],
            },
        },
        {
            id: AuthType.HOPCODE_OAUTH,
            name: 'HopCode OAuth',
            description: 'HopCode OAuth (free tier discontinued 2026-04-15)',
            _meta: {
                type: 'terminal',
                args: ['--auth-type=hopcode-oauth'],
            },
        },
    ];
}
export function filterAuthMethodsById(authMethods, authMethodId) {
    return authMethods.filter((method) => method.id === authMethodId);
}
export function pickAuthMethodsForDetails(details) {
    const authMethods = buildAuthMethods();
    if (!details) {
        return authMethods;
    }
    if (details.includes('hopcode-oauth') || details.includes('HopCode OAuth')) {
        const narrowed = filterAuthMethodsById(authMethods, AuthType.HOPCODE_OAUTH);
        return narrowed.length ? narrowed : authMethods;
    }
    return authMethods;
}
//# sourceMappingURL=authMethods.js.map